/* =====================================================
   SYSTEM HEADER / NAVBAR
   ===================================================== */

:root {
    --header-blue: #2563eb;
    --header-blue-dark: #1d4ed8;
    --header-blue-soft: #eff6ff;

    --header-slate-950: #0f172a;
    --header-slate-900: #1e293b;
    --header-slate-800: #334155;
    --header-slate-700: #475569;
    --header-slate-600: #64748b;
    --header-slate-500: #94a3b8;
    --header-slate-300: #cbd5e1;
    --header-slate-200: #e2e8f0;

    --header-red: #dc2626;
    --header-red-soft: #fef2f2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        "Sarabun",
        "Noto Sans Thai",
        "Leelawadee UI",
        Tahoma,
        Arial,
        sans-serif;
    background: #f8fafc;
    color: var(--header-slate-800);
}

/* =====================================================
   NAVBAR
   ===================================================== */

.system-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    min-height: 72px;

    display: flex;
    align-items: center;

    padding: 0 24px;

    border-bottom: 1px solid var(--header-slate-200);

    background: rgba(255, 255, 255, .97);

    box-shadow:
        0 3px 15px rgba(15, 23, 42, .06);

    backdrop-filter: blur(12px);
}

.system-navbar-guest {
    justify-content: flex-start;
}


/* =====================================================
   BRAND
   ===================================================== */

.system-brand {
    min-width: 230px;

    display: inline-flex;
    align-items: center;

    gap: 11px;

    color: var(--header-slate-950);
    text-decoration: none;

    flex-shrink: 0;
}

.brand-logo {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            #dbeafe,
            #eff6ff
        );

    font-size: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.brand-text small {
    margin-top: 3px;

    color: var(--header-slate-500);

    font-size: 11px;
    font-weight: 500;
}


/* =====================================================
   NAVIGATION
   ===================================================== */

.system-nav {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    margin-left: 22px;
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 4px;

    min-width: 0;
}

.nav-item {
    min-height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 8px 12px;

    border-radius: 10px;

    color: var(--header-slate-700);

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    white-space: nowrap;

    transition:
        background .16s ease,
        color .16s ease,
        transform .16s ease;
}

.nav-item:hover {
    background: var(--header-slate-100, #f1f5f9);
    color: var(--header-slate-950);
}

.nav-item:active {
    transform: translateY(1px);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 19px;

    font-size: 16px;
    line-height: 1;
}

.nav-primary {
    color: var(--header-blue);
    background: var(--header-blue-soft);
}

.nav-primary:hover {
    color: white;
    background: var(--header-blue);
}

.nav-management {
    color: #1d4ed8;
}

.nav-management:hover {
    color: #1e40af;
    background: #eff6ff;
}

.nav-admin {
    color: #be123c;
}

.nav-admin:hover {
    color: #9f1239;
    background: #fff1f2;
}

.nav-divider {
    width: 1px;
    height: 27px;

    margin: 0 5px;

    background: var(--header-slate-200);
}


/* =====================================================
   USER AREA
   ===================================================== */

.nav-user-area {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;
}

.user-profile {
    min-height: 48px;

    display: inline-flex;
    align-items: center;

    gap: 9px;

    padding: 4px 9px 4px 4px;

    border-radius: 12px;

    color: var(--header-slate-800);
    text-decoration: none;

    transition: background .16s ease;
}

.user-profile:hover {
    background: #f8fafc;
}

.user-avatar {
    width: 37px;
    height: 37px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #dbeafe,
            #bfdbfe
        );

    color: #1d4ed8;

    font-size: 15px;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;

    line-height: 1.2;
}

.user-info strong {
    max-width: 135px;

    overflow: hidden;

    color: var(--header-slate-900);

    font-size: 13px;
    font-weight: 800;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info small {
    margin-top: 3px;

    color: var(--header-slate-500);

    font-size: 10px;
    font-weight: 600;
}

.user-divider {
    width: 1px;
    height: 30px;

    background: var(--header-slate-200);
}

.logout-button {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 8px 11px;

    border: 1px solid #fecaca;
    border-radius: 9px;

    background: var(--header-red-soft);
    color: var(--header-red);

    text-decoration: none;

    font-size: 12px;
    font-weight: 750;

    transition:
        background .16s ease,
        color .16s ease;
}

.logout-button:hover {
    background: #fee2e2;
    color: #b91c1c;
}


/* =====================================================
   MOBILE TOGGLE
   ===================================================== */

.navbar-toggle {
    display: none;

    width: 42px;
    height: 42px;

    margin-left: auto;

    border: 1px solid var(--header-slate-200);
    border-radius: 10px;

    background: white;
    color: var(--header-slate-700);

    font-size: 20px;

    cursor: pointer;
}


/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1280px) {

    .system-navbar {
        padding: 0 16px;
    }

    .system-brand {
        min-width: 205px;
    }

    .system-nav {
        gap: 10px;
        margin-left: 12px;
    }

    .nav-item {
        padding-left: 9px;
        padding-right: 9px;

        font-size: 13px;
    }

    .user-info {
        display: none;
    }

    .user-profile {
        padding-right: 4px;
    }
}


@media (max-width: 1050px) {

    .system-navbar {
        min-height: 68px;
        flex-wrap: wrap;
    }

    .navbar-toggle {
        display: grid;
        place-items: center;
    }

    .system-nav {
        display: none;

        width: 100%;

        flex-direction: column;
        align-items: stretch;

        gap: 5px;

        margin: 0;
        padding: 10px 0 14px;

        border-top: 1px solid var(--header-slate-200);
    }

    .system-nav.is-open {
        display: flex;
    }

    .nav-main {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-item {
        justify-content: flex-start;

        min-height: 46px;

        padding: 10px 13px;

        font-size: 15px;
    }

    .nav-divider {
        width: 100%;
        height: 1px;

        margin: 6px 0;
    }

    .nav-user-area {
        width: 100%;

        justify-content: space-between;

        padding-top: 9px;

        border-top: 1px solid var(--header-slate-200);
    }

    .user-info {
        display: flex;
    }

    .user-profile {
        padding: 4px 9px 4px 4px;
    }

    .logout-button {
        min-height: 42px;

        padding: 9px 14px;

        font-size: 13px;
    }
}


@media (max-width: 600px) {

    .system-navbar {
        padding: 0 12px;
    }

    .system-brand {
        min-width: 0;
    }

    .brand-logo {
        width: 37px;
        height: 37px;
    }

    .brand-text strong {
        font-size: 15px;
    }

    .brand-text small {
        font-size: 10px;
    }

    .user-info {
        display: none;
    }

    .user-divider {
        display: none;
    }

    .nav-user-area {
        align-items: center;
    }
}
