/**
 * assets/css/app.css
 * Global stylesheet cho phần public của dự án.
 * Các trang cụ thể có thể override qua <style> nội tuyến hoặc file riêng.
 */

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --hsk-primary:   #dc2626;
    --hsk-dark:      #0f172a;
    --hsk-muted:     #64748b;
    --hsk-bg:        #f8fafc;
    --hsk-border:    #e2e8f0;
    --hsk-radius:    16px;
    --hsk-font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    /* Dùng font do theme.php inject qua --hsk-font-body; fallback về --hsk-font */
    font-family: var(--hsk-font-body, var(--hsk-font));
    background-color: var(--hsk-bg);
    color: var(--hsk-dark);
    overflow-x: hidden;
    line-height: 1.6;
}

a { color: var(--hsk-primary); }
a:hover { color: #b91c1c; }

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */
.hsk-nav {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}
.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--hsk-dark) !important;
    font-size: 1.4rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-hsk {
    background: var(--hsk-primary);
    color: #fff;
    border-radius: 50px;
    font-weight: 700;
    padding: .65rem 2rem;
    border: none;
    transition: all 0.2s;
}
.btn-hsk:hover {
    background: #b91c1c;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220,38,38,.25);
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card-hsk {
    background: #fff;
    border: 1px solid var(--hsk-border);
    border-radius: var(--hsk-radius);
    transition: transform 0.25s, box-shadow 0.25s;
}
.card-hsk:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px -6px rgba(15,23,42,.10);
}

/* ─── Page padding (account for fixed navbar ≈ 64px) ─────────────────────────── */
.page-body {
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Flash alerts ────────────────────────────────────────────────────────────── */
.flash-alert {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 9999;
    min-width: 280px;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .page-body { padding-top: 68px; }
}

/* ─── Mobile-first global improvements ─────────────────────────────────────── */

/* Safe-area inset for notched phones (iPhone X+) */
:root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top:    env(safe-area-inset-top, 0px);
}

/* Prevent horizontal overflow site-wide */
html { overflow-x: hidden; }

/* Smooth momentum scrolling on iOS */
* { -webkit-overflow-scrolling: touch; }

/* Flash alerts — mobile fix */
@media (max-width: 600px) {
    .flash-alert {
        top: auto;
        bottom: calc(16px + var(--safe-bottom));
        right: 12px;
        left: 12px;
        max-width: none;
        min-width: 0;
        font-size: 14px;
    }
}

/* Card hover — disable on touch to prevent sticky hover */
@media (hover: none) {
    .card-hsk:hover {
        transform: none;
        box-shadow: none;
    }
    .btn-hsk:hover {
        transform: none;
    }
}

/* Buttons — ensure 44px minimum touch target */
.btn-hsk {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Typography — base size increase on small screens */
@media (max-width: 400px) {
    body { font-size: 15px; }
}

/* Page padding — account for notch on very small screens */
@media (max-width: 360px) {
    .page-body { padding-top: 64px; }
}

/* Offcanvas mini cart — better mobile padding */
@media (max-width: 480px) {
    .offcanvas-body { padding: 1rem !important; }
    .offcanvas-header { padding: 0.875rem 1rem !important; }
    .offcanvas-footer { padding: 0.875rem 1rem !important; }
}
