/* ═══════════════════════════════════════════════════════════════
   superstav — Shared Design System
   Liquid Glass · Warm Light Mode · visionOS-inspired
   
   4 Glass Layers:
     1. Base gradient      — warm translucent body
     2. Refraction highlight — ::before light bending
     3. Saturating blur     — backdrop-filter frost
     4. Beveled borders     — directional light edges
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --bg: #F8F6F1;
    --fg: #1C1915;
    --muted: #8A8477;
    --accent: #C8963E;
    --accent-light: #F0D9A8;
    --beige: #E8DCC8;
    --amber: #D4883E;
    --card: rgba(255, 255, 255, 0.40);
    --border: rgba(255, 255, 255, 0.65);
    --success: #8FBC3B;
    --error: #C0504D;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Ambient Background Orbs ── */
.ambient-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(200,150,62,0.12) 0%, transparent 70%);
    top: -120px; right: -100px;
    animation: drift-1 25s ease-in-out infinite;
}
.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(212,136,62,0.1) 0%, transparent 70%);
    bottom: 10%; left: -80px;
    animation: drift-2 30s ease-in-out infinite;
}
@keyframes drift-1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-40px, 30px); }
    66% { transform: translate(20px, -20px); }
}
@keyframes drift-2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -40px); }
    66% { transform: translate(-20px, 20px); }
}

/* ── Liquid Glass Base ── */
.liquid-glass {
    position: relative;
    /* Layer 1: Base gradient */
    background: linear-gradient(135deg, rgba(255,255,255,0.55) 0%, rgba(255,248,235,0.30) 40%, rgba(255,255,255,0.45) 100%);
    /* Layer 3: Saturating blur */
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    /* Layer 4: Beveled borders */
    border: 1px solid var(--border);
    border-top-color: rgba(255,255,255,0.85);
    border-left-color: rgba(255,255,255,0.75);
    box-shadow: 0 8px 32px rgba(180,140,60,0.08), 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 2px rgba(255,255,255,0.8), inset 0 -1px 2px rgba(0,0,0,0.02);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Layer 2: Refraction highlight */
.liquid-glass::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.0) 100%);
    pointer-events: none;
    border-radius: inherit;
}

/* Content above the ::before shimmer */
.liquid-glass > .z-content {
    position: relative;
    z-index: 1;
}

/* ── Global Header ── */
.global-header {
    position: relative;
    z-index: 50;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.global-header .logo {
    font-family: 'Space Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}
.global-header .logo:hover { opacity: 0.8; }

.global-header .nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.global-header .nav-link {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s;
}
.global-header .nav-link:hover { color: var(--accent); }
.global-header .nav-link.active { color: var(--accent); }

/* Header auth section */
.header-auth {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-inbox-btn {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-light), var(--beige));
    border: 1px solid rgba(255,255,255,0.6);
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(200,150,62,0.15);
    text-decoration: none;
}
.header-inbox-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(200,150,62,0.25);
}
.inbox-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.inbox-badge.visible { display: flex; }

/* User dropdown */
.user-menu-wrap {
    position: relative;
}
.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,248,235,0.30));
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.5);
    border-top-color: rgba(255,255,255,0.75);
    border-left-color: rgba(255,255,255,0.65);
    box-shadow: 0 2px 8px rgba(200,150,62,0.1), inset 0 1px 1px rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
}
.user-btn:hover {
    box-shadow: 0 4px 16px rgba(180,140,60,0.15), inset 0 1px 1px rgba(255,255,255,0.8);
}
.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}
.user-btn .chevron {
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.2s;
}
.user-btn-compact {
    padding: 6px !important;
    width: 40px; height: 40px;
    justify-content: center;
}
.user-btn.open .chevron { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 12px;
    border-radius: 20px;
    z-index: 100;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.user-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--fg);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}
.dropdown-item:hover { background: rgba(200,150,62,0.08); }
.dropdown-item i { width: 16px; text-align: center; color: var(--accent); font-size: 14px; }
.dropdown-sep { height: 1px; background: var(--beige); margin: 6px 0; }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger i { color: var(--error); }

/* Login button (when not authenticated) — Liquid Glass */
.login-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(200,150,62,0.3), rgba(212,136,62,0.2));
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.5);
    border-top-color: rgba(255,255,255,0.7);
    border-left-color: rgba(255,255,255,0.6);
    box-shadow: 0 2px 8px rgba(200,150,62,0.12), inset 0 1px 1px rgba(255,255,255,0.6);
    color: var(--accent);
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
}
.login-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
    pointer-events: none;
    border-radius: inherit;
}
.login-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(200,150,62,0.4), rgba(212,136,62,0.3));
    box-shadow: 0 4px 16px rgba(200,150,62,0.2), inset 0 1px 1px rgba(255,255,255,0.8);
}

/* ── Toast System ── */
.toast-container {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}
.toast {
    padding: 10px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(255,248,235,0.5));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.5);
    border-left: 3px solid var(--accent);
    box-shadow: 0 4px 20px rgba(180,140,60,0.1);
    font-size: 13px;
    color: var(--fg);
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    white-space: nowrap;
    pointer-events: auto;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--error); }

/* ── Modal System ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 30, 20, 0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-overlay.open .modal-card { transform: translateY(0); }

/* ── Skeleton Loading ── */
@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}
.skeleton-card {
    border-radius: 32px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(248,244,237,0.2));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    animation: shimmer 1.5s infinite;
    min-height: 120px;
}
.skeleton-card .s-line { height: 14px; background: rgba(0,0,0,0.06); border-radius: 6px; margin-bottom: 10px; }
.skeleton-card .s-title { width: 60%; height: 18px; }
.skeleton-card .s-body { width: 100%; }
.skeleton-card .s-body-short { width: 70%; }

/* ── Animations ── */
@keyframes pulse-glow {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(200,150,62,0.4); }
    50% { opacity: 0.7; transform: scale(1.2); box-shadow: 0 0 0 6px rgba(200,150,62,0); }
}
@keyframes card-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes blink-sep {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.2; }
}

/* ── Empty / Error States ── */
.state-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.state-message .state-icon { font-size: 48px; margin-bottom: 16px; }
.state-message .state-title { font-size: 18px; font-weight: 600; color: var(--fg); margin-bottom: 8px; }
.state-message .state-sub { font-size: 14px; margin-bottom: 20px; }
.state-message .state-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(200,150,62,0.45), rgba(212,136,62,0.3));
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.5);
    border-top-color: rgba(255,255,255,0.7);
    border-left-color: rgba(255,255,255,0.6);
    box-shadow: 0 2px 12px rgba(200,150,62,0.15), inset 0 1px 1px rgba(255,255,255,0.6);
    color: var(--fg);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
}
.state-message .state-action::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
    pointer-events: none;
    border-radius: inherit;
}
.state-message .state-action:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(200,150,62,0.55), rgba(212,136,62,0.4));
    box-shadow: 0 4px 16px rgba(200,150,62,0.25), inset 0 1px 1px rgba(255,255,255,0.8);
}

/* ── Focus Visible ── */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .global-header { padding: 16px 16px; }
    .global-header .nav-links { gap: 14px; }
    .global-header .nav-link { font-size: 11px; }
}
@media (max-width: 480px) {
    .global-header { padding: 14px 12px; gap: 8px; }
    .global-header .logo { font-size: 18px; letter-spacing: 4px; }
    .global-header .nav-link { display: none; }
}

/* ── Hamburger Navigation ── */
.hamburger-btn-inline {
    width: 40px; height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,248,235,0.30));
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.5);
    border-top-color: rgba(255,255,255,0.7);
    border-left-color: rgba(255,255,255,0.6);
    box-shadow: 0 2px 8px rgba(200,150,62,0.12), inset 0 1px 1px rgba(255,255,255,0.6);
    color: var(--accent);
    font-size: 17px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-right: 6px;
}
.hamburger-btn-inline:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(200,150,62,0.2), inset 0 1px 1px rgba(255,255,255,0.8);
}
.hamburger-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.hamburger-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.hamburger-overlay .hamburger-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 22, 12, 0.35);
}
.hamburger-overlay .hamburger-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 0;
    border-right: none;
    border-top: none;
    border-bottom: none;
}
.hamburger-overlay.open .hamburger-panel {
    transform: translateX(0);
}
.hamburger-overlay .hamburger-close {
    align-self: flex-end;
    width: 36px; height: 36px;
    border-radius: 12px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
    color: var(--fg);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-bottom: 8px;
}
.hamburger-overlay .hamburger-close:hover {
    background: rgba(255,255,255,0.4);
}
.hamburger-overlay .hamburger-panel .nav-brand {
    font-family: 'Space Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--accent);
    margin-bottom: 24px;
    padding-left: 4px;
}
.hamburger-overlay .hamburger-panel .nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--fg);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    font-family: 'Sora', sans-serif;
}
.hamburger-overlay .hamburger-panel .nav-item:hover {
    background: rgba(200,150,62,0.08);
}
.hamburger-overlay .hamburger-panel .nav-item i {
    width: 20px;
    text-align: center;
    color: var(--accent);
    font-size: 16px;
}
.hamburger-overlay .hamburger-panel .nav-sep {
    height: 1px;
    background: var(--beige);
    margin: 8px 0;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
