/* ==========================================================================
TOKENS — same system used across the platform (Register / Login)
========================================================================== */
:root {
    --c-900: #213A57;
    --c-700: #0B6477;
    --c-600: #14919B;
    --c-500: #0AD1C8;
    --c-400: #45DFB1;
    --c-300: #80ED99;

    --font-body: 'Cairo', system-ui, sans-serif;
    --radius-lg: 20px;
    --radius-md: 14px;
    --ease-glass: cubic-bezier(.22, 1, .36, 1);
    --dur-fast: .22s;
    --dur-med: .45s;

    --nav-h: 76px;
}

[data-theme="dark"] {
    --bg-canvas: #182c42;
    --surface-1: rgba(255, 255, 255, .055);
    --surface-2: rgba(255, 255, 255, .09);
    --surface-solid: #1c3350;
    --border-glass: rgba(255, 255, 255, .14);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, .68);
    --text-muted: rgba(255, 255, 255, .42);
    --shadow-card: 0 20px 55px -20px rgba(8, 16, 26, .6);
    --nav-bg-top: linear-gradient(180deg, rgba(24, 44, 66, .55) 0%, rgba(24, 44, 66, .15) 70%, transparent 100%);
    --nav-bg-scrolled: rgba(20, 38, 58, .78);
    --danger: #ff6b6b;
}

[data-theme="light"] {
    --bg-canvas: #eef6f6;
    --surface-1: rgba(33, 58, 87, .045);
    --surface-2: rgba(33, 58, 87, .08);
    --surface-solid: #ffffff;
    --border-glass: rgba(33, 58, 87, .13);
    --text-primary: #16283d;
    --text-secondary: rgba(22, 40, 61, .66);
    --text-muted: rgba(22, 40, 61, .4);
    --shadow-card: 0 20px 55px -25px rgba(33, 58, 87, .25);
    --nav-bg-top: linear-gradient(180deg, rgba(238, 246, 246, .6) 0%, rgba(238, 246, 246, .1) 70%, transparent 100%);
    --nav-bg-scrolled: rgba(255, 255, 255, .82);
    --danger: #e0483f;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg-canvas);
    color: var(--text-primary);
    transition: background var(--dur-med) var(--ease-glass), color var(--dur-med) var(--ease-glass);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

a:focus-visible,
button:focus-visible,
label:focus-within {
    outline: 2px solid var(--c-400);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ==========================================================================
NAVBAR
========================================================================== */
.site-nav {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 1000;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    background: var(--nav-bg-top);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background var(--dur-med) var(--ease-glass), backdrop-filter var(--dur-med) var(--ease-glass), box-shadow var(--dur-med) var(--ease-glass), height var(--dur-med) var(--ease-glass);
}

.site-nav.is-scrolled {
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 10px 30px -18px rgba(8, 16, 26, .45);
    height: calc(var(--nav-h) - 10px);
}

/* scroll-progress strip glued to the bottom edge of the navbar */
.nav-progress {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--c-700), var(--c-500), var(--c-300));
    background-size: 200% 100%;
    box-shadow: 0 0 12px 1px color-mix(in srgb, var(--c-500) 65%, transparent);
    transition: width .12s linear;
}

.nav-container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.08rem;
    color: var(--text-primary);
}

.brand .mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--c-600), var(--c-400));
    color: #0b1a26;
    font-weight: 900;
    font-size: 1rem;
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--c-500) 60%, transparent);
}

.brand small {
    display: block;
    font-size: .72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-btn {
    text-decoration: none;
    font-size: .85rem;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 999px;
    transition: transform var(--dur-fast) var(--ease-glass), box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
}

.nav-btn.ghost {
    color: var(--text-primary);
    background: var(--surface-2);
    border: 1px solid var(--border-glass);
}

.nav-btn.ghost:hover {
    background: var(--surface-1);
    transform: translateY(-1px);
}

.nav-btn.solid {
    color: #0b1a26;
    background: linear-gradient(120deg, var(--c-400), var(--c-500) 55%, var(--c-300));
    box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--c-500) 65%, transparent);
}

.nav-btn.solid:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--c-500) 75%, transparent);
}

/* ==========================================================================
WALLET CHIP — balance + top-up
========================================================================== */
.wallet-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.wallet-icon {
    width: 18px;
    height: 18px;
    color: var(--c-400);
    flex-shrink: 0;
}

.wallet-icon svg {
    width: 100%;
    height: 100%;
}

.wallet-value {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.wallet-add {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 800;
    color: #0b1a26;
    background: linear-gradient(120deg, var(--c-400), var(--c-500) 55%, var(--c-300));
    box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--c-500) 65%, transparent);
    transition: transform var(--dur-fast) var(--ease-glass);
}

.wallet-add:hover {
    transform: scale(1.08);
}

.wallet-add:active {
    transform: scale(.96);
}

/* ==========================================================================
USER MENU — avatar trigger + dropdown (History / Geography / Redeem / Logout)
========================================================================== */
.user-menu {
    position: relative;
    flex-shrink: 0;
}

.user-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: linear-gradient(135deg, var(--c-600), var(--c-400));
    color: #0b1a26;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    transition: transform var(--dur-fast) var(--ease-glass), box-shadow var(--dur-fast) ease;
}

.user-trigger svg {
    width: 19px;
    height: 19px;
}

.user-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--c-500) 60%, transparent);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    inset-inline-end: 0;
    min-width: 210px;
    padding: 8px;
    border-radius: var(--radius-md);
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top left;
    transition: opacity var(--dur-fast) ease, transform var(--dur-med) var(--ease-glass), visibility var(--dur-fast);
}

.user-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    text-align: right;
    transition: background var(--dur-fast) ease;
}

.user-item:hover {
    background: var(--surface-2);
}

.user-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--c-400);
}

.user-item.danger {
    color: var(--danger);
}

.user-item.danger svg {
    color: var(--danger);
}

.user-item.danger:hover {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.user-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--border-glass);
}

/* ==========================================================================
HAMBURGER — mobile trigger, morphs into an X
========================================================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text-primary);
    transition: transform var(--dur-med) var(--ease-glass), opacity var(--dur-fast) ease;
}

.hamburger.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.is-open span:nth-child(2) {
    opacity: 0;
}

.hamburger.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
MOBILE MENU — full-width glass dropdown with the two auth buttons
========================================================================== */
.mobile-menu {
    position: fixed;
    top: var(--nav-h);
    inset-inline: 0;
    z-index: 999;
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 20px 40px -20px rgba(8, 16, 26, .5);
    transition: max-height var(--dur-med) var(--ease-glass), opacity var(--dur-fast) ease, padding var(--dur-med) ease;
}

.mobile-menu.is-open {
    max-height: 220px;
    opacity: 1;
    visibility: visible;
    padding: 18px 20px 24px;
}

.mobile-menu .nav-btn {
    width: 100%;
    text-align: center;
    padding: 14px 18px;
    font-size: .95rem;
}

.mobile-menu .nav-btn.ghost span {
    display: inline;
}

/* account items reused inside the mobile menu (bigger tap targets) */
.mobile-menu .user-item {
    padding: 14px 16px;
    font-size: .95rem;
}

.mobile-menu .user-divider {
    margin: 8px 4px;
}

@media (max-width: 680px) {

    .nav-actions>.nav-btn,
    .user-menu {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .mobile-menu {
        display: flex;
    }
    
}

/* ==========================================================================
THEME TOGGLE — liquid glass sun/moon switch
========================================================================== */
.theme-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.tt-track {
    position: relative;
    width: 60px;
    height: 30px;
    border-radius: 999px;
    padding: 3px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--c-700), var(--c-600));
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .22), 0 6px 16px -8px rgba(8, 16, 26, .5);
    transition: background var(--dur-med) var(--ease-glass), box-shadow var(--dur-med) ease;
    overflow: hidden;
}

.tt-track::before {
    /* ambient stars, only visible in dark state */
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image:
        radial-gradient(1.4px 1.4px at 12px 8px, #fff 100%, transparent 100%),
        radial-gradient(1.4px 1.4px at 22px 18px, #fff 100%, transparent 100%),
        radial-gradient(1.2px 1.2px at 30px 9px, #fff 100%, transparent 100%);
    transition: opacity var(--dur-med) ease;
}

.theme-toggle input:checked+.tt-track {
    background: linear-gradient(135deg, var(--c-900), #0e1e30);
}

.theme-toggle input:checked+.tt-track::before {
    opacity: .9;
}

.theme-toggle input:focus-visible+.tt-track {
    outline: 2px solid var(--c-400);
    outline-offset: 3px;
}

.tt-thumb {
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #fff, var(--c-300) 140%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .28), 0 0 0 0 color-mix(in srgb, var(--c-300) 70%, transparent);
    transform: translateX(0);
    transition: transform var(--dur-med) var(--ease-glass), background var(--dur-med) ease, box-shadow var(--dur-med) ease;
}

.theme-toggle input:checked+.tt-track .tt-thumb {
    transform: translateX(-30px);
    background: linear-gradient(160deg, var(--c-500), var(--c-700) 140%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .4), 0 0 14px 1px color-mix(in srgb, var(--c-500) 60%, transparent);
}

.tt-thumb svg {
    width: 14px;
    height: 14px;
    position: absolute;
    color: #0b1a26;
    transition: opacity var(--dur-fast) ease, transform var(--dur-med) var(--ease-glass);
}

.tt-thumb .sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.tt-thumb .moon {
    opacity: 0;
    transform: rotate(-90deg) scale(.4);
    color: #fff;
}

.theme-toggle input:checked+.tt-track .tt-thumb .sun {
    opacity: 0;
    transform: rotate(90deg) scale(.4);
}

.theme-toggle input:checked+.tt-track .tt-thumb .moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@media (prefers-reduced-motion: reduce) {

    .tt-thumb,
    .tt-track,
    .tt-thumb svg {
        transition: none !important;
    }
}

/* ==========================================================================
    WALLET CHIP — balance + top-up
    ========================================================================== */
.wallet-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.wallet-icon {
    width: 18px;
    height: 18px;
    color: var(--c-400);
    flex-shrink: 0;
}

.wallet-icon svg {
    width: 100%;
    height: 100%;
}

.wallet-value {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.wallet-add {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 800;
    color: #0b1a26;
    background: linear-gradient(120deg, var(--c-400), var(--c-500) 55%, var(--c-300));
    box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--c-500) 65%, transparent);
    transition: transform var(--dur-fast) var(--ease-glass);
}

.wallet-add:hover {
    transform: scale(1.08);
}

.wallet-add:active {
    transform: scale(.96);
}

/* ==========================================================================
    USER MENU — avatar trigger + dropdown (History / Geography / Redeem / Logout)
    ========================================================================== */
.user-menu {
    position: relative;
    flex-shrink: 0;
}

.user-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: linear-gradient(135deg, var(--c-600), var(--c-400));
    color: #0b1a26;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    transition: transform var(--dur-fast) var(--ease-glass), box-shadow var(--dur-fast) ease;
}

.user-trigger svg {
    width: 19px;
    height: 19px;
}

.user-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--c-500) 60%, transparent);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    inset-inline-end: 0;
    min-width: 210px;
    padding: 8px;
    border-radius: var(--radius-md);
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top left;
    transition: opacity var(--dur-fast) ease, transform var(--dur-med) var(--ease-glass), visibility var(--dur-fast);
}

.user-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    text-align: right;
    transition: background var(--dur-fast) ease;
}

.user-item:hover {
    background: var(--surface-2);
}

.user-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--c-400);
}

.user-item.danger {
    color: var(--danger);
}

.user-item.danger svg {
    color: var(--danger);
}

.user-item.danger:hover {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.user-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--border-glass);
}

/* ==========================================================================
    HAMBURGER — mobile trigger, morphs into an X
    ========================================================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text-primary);
    transition: transform var(--dur-med) var(--ease-glass), opacity var(--dur-fast) ease;
}

.hamburger.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.is-open span:nth-child(2) {
    opacity: 0;
}

.hamburger.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
           MOBILE MENU — full-width glass dropdown
           (logged-out state shows the two auth buttons;
            logged-in state — used here — shows the 4 account items instead)
           ========================================================================== */
.mobile-menu {
    position: fixed;
    top: var(--nav-h);
    inset-inline: 0;
    z-index: 999;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 20px 40px -20px rgba(8, 16, 26, .5);
    transition: max-height var(--dur-med) var(--ease-glass), opacity var(--dur-fast) ease, padding var(--dur-med) ease;
}

.mobile-menu.is-open {
    max-height: 360px;
    opacity: 1;
    visibility: visible;
    padding: 18px 20px 24px;
}

.mobile-menu .user-item {
    padding: 14px 16px;
    font-size: .95rem;
}

.mobile-menu .user-divider {
    margin: 8px 4px;
}

/* login/register variant kept for logged-out pages that reuse this same stylesheet */
.mobile-menu .nav-btn {
    width: 100%;
    text-align: center;
    padding: 14px 18px;
    font-size: .95rem;
}

@media (max-width: 680px) {

    .nav-actions>.nav-btn,
    .user-menu {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .mobile-menu {
        display: flex;
    }
    .brand {
        gap: 5px;
        font-size: 0.88rem;
    }

    .brand .mark {
        width: 20px;
        height: 20px;
        font-size: 0.5rem;
    }
    .brand-text {
        font-size: 10px;
    }
}