/* --- LOAD FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #E9EAEE !important;
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* --- LAYOUT VARIABLES --- */
:root {
    --spacing: 12px;
    --sidebar-width: 210px;
    --top-nav-height: 120px;
    --radius-card: 16px;
    --radius-pill: 999px;
    --shadow-card: 0 2px 8px rgba(16, 24, 40, 0.06);
    --shadow-card-hover: 0 8px 24px rgba(16, 24, 40, 0.06);
}

/* --- CORE LAYOUT STRUCTURE --- */
.nav {
    position: fixed;
    top: var(--spacing);
    left: var(--spacing);
    bottom: var(--spacing);
    width: var(--sidebar-width);
    padding-top: 40px;
    background-color: #F6F7F8;
    border-radius: var(--radius-card);
}

.top-nav {
    /* CHANGED: Absolute positioning allows it to scroll away with the page content */
    position: absolute;
    top: var(--spacing);
    left: calc(var(--sidebar-width) + var(--spacing) * 2);
    right: var(--spacing);
    height: var(--top-nav-height);
    background-color: #F6F7F8;
    border-radius: var(--radius-card);
    z-index: 9999;
}

main {
    margin-left: calc(var(--sidebar-width) + var(--spacing) * 2);
    padding-top: calc(var(--top-nav-height) + var(--spacing) * 2);
    padding-right: var(--spacing);
}

/* --- CUSTOM COMPONENT SIZING & COLORS --- */
.title {
    padding-bottom: 30px;
    width: 80%;
}

.menu img {
    width: 88%;
}

.selection {
    cursor: pointer;
    padding: 6px 10px;
    margin: 0 8px;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.nav-home     { --nav-color: #2E79C1; --nav-color-soft: rgba(46, 121, 193, 0.1); }
.nav-settings { --nav-color: #D97706; --nav-color-soft: rgba(217, 119, 6, 0.1); }
.nav-profile  { --nav-color: #4338CA; --nav-color-soft: rgba(67, 56, 202, 0.1); }
.nav-tickets  { --nav-color: #1B5E20; --nav-color-soft: rgba(27, 94, 32, 0.1); }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.nav-link:hover,
.nav-link:focus {
    text-decoration: none;
    color: inherit;
}

.nav-badge {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #EEF0F3;
    color: #9C9B9B;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-badge svg {
    width: 20px;
    height: 20px;
}

.nav-label {
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.selection.active {
    background-color: var(--nav-color-soft);
}

.selection.active .nav-badge {
    background-color: var(--nav-color);
    color: #FFFFFF;
}

.selection.active .nav-label {
    color: var(--nav-color);
    font-weight: 700;
}

.top-nav img {
    width: 80px;
}

/* Struktur inti .top-icon/.diva/.user-profile/.divs sengaja ditulis ulang
   di sini (bukan cuma diserahkan ke utility class Bootstrap) supaya nav
   atas tidak berantakan/tumpang tindih dengan konten di bawahnya kalau
   CDN Bootstrap lambat/gagal dimuat. */
.top-icon {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 24px;
}

.diva {
    flex-grow: 1;
}

.top-icon > a {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.top-icon > a img {
    width: 60px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 2px solid #E9EAEE;
    padding-left: 12px;
}

.user-profile a img {
    width: 60px;
}

.divs {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.username {
    font-size: 2.5ch;
}

.Email-name {
    font-size: 2ch;
    color: #9C9B9B;
}

/* ============================================
   RESPONSIVE — global layout
   Tempel di AKHIR global.css.
   Desktop (>900px) tidak berubah sama sekali.
   ============================================ */

/* ---------- Tablet (≤900px) ----------
   Sidebar tetap di kiri, hanya diciutkan jadi ikon saja. */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 82px;
        --top-nav-height: 88px;
    }

    .nav {
        padding-top: 24px;
    }

    .title,
    .menu {
        display: none;
    }

    .selection {
        margin: 0 4px;
        padding: 6px;
    }

    .nav-link {
        justify-content: center;
    }

    .nav-label {
        display: none;
    }

    .nav-badge {
        width: 32px;
        height: 32px;
    }

    .nav-badge svg {
        width: 16px;
        height: 16px;
    }

    .nav .icon {
        gap: 10px !important;
    }

    .top-nav img {
        width: 60px;
    }

    .top-icon > a {
        margin-right: 12px;
    }

    .top-icon > a img {
        width: 42px;
    }

    .user-profile a img {
        width: 46px;
    }

    .username {
        font-size: 14px;
    }

    .Email-name {
        font-size: 12px;
    }
}

/* ---------- Ponsel (≤640px) ----------
   Sidebar pindah ke bawah jadi bottom navigation. */
@media (max-width: 640px) {
    :root {
        --sidebar-width: 0px;
        --top-nav-height: 64px;
        --bottom-nav-height: 62px;
    }

    /* --- Sidebar → bottom bar --- */
    .nav {
        top: auto;
        bottom: var(--spacing);
        left: var(--spacing);
        right: var(--spacing);
        width: auto;
        height: var(--bottom-nav-height);
        padding-top: 0;
        z-index: 10000;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    }

    .nav .icon {
        flex-direction: row !important;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        height: 100%;
        gap: 0 !important;
        padding-inline: 8px;
    }

    .top-nav {
        right: var(--spacing);
    }

    .title,
    .menu {
        display: none;
    }

    .selection {
        flex: 1;
        width: auto !important;
        justify-content: center;
        padding: 4px 2px;
        margin: 0;
        border-radius: 10px;
    }

    .nav-link {
        flex-direction: column;
        gap: 2px;
        justify-content: center;
    }

    .nav-label {
        display: block;
        font-size: 10px;
        font-weight: 600;
        color: #9C9B9B;
    }

    .selection.active .nav-label {
        color: var(--nav-color);
    }

    .nav-badge {
        width: 30px;
        height: 30px;
    }

    .nav-badge svg {
        width: 16px;
        height: 16px;
    }

    /* --- Top nav --- */
    .top-nav {
        left: var(--spacing);
    }

    .top-icon {
        padding: 0 14px !important;
    }

    .top-nav img {
        width: 46px;
    }

    .top-icon > a {
        margin-right: 8px;
    }

    .top-icon > a img {
        width: 30px;
    }

    .user-profile {
        gap: 8px !important;
        padding-left: 10px !important;
    }

    .user-profile a img {
        width: 34px;
    }

    .username {
        font-size: 12px;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .Email-name {
        display: none;
    }

    /* --- Main content --- */
    main {
        margin-left: 0;
        padding-left: var(--spacing);
        padding-right: var(--spacing);
        /* ruang untuk bottom nav */
        padding-bottom: calc(var(--bottom-nav-height) + var(--spacing) * 2);
    }

    /* Cart bar naik supaya tidak tertutup bottom nav */
    #cart-bar {
        bottom: calc(var(--bottom-nav-height) + var(--spacing) * 2);
    }
}

/* ---------- Ponsel kecil (≤400px) ---------- */
@media (max-width: 400px) {
    .top-icon > a:not(:last-of-type) {
        display: none;
    }

    .username {
        max-width: 70px;
    }

    .nav-badge {
        width: 26px;
        height: 26px;
    }

    .nav-label {
        font-size: 9px;
    }
}