/* =============================================================
   ZELAVRO SHARED DESIGN SYSTEM
   Tokens, app shell (top bar + mobile tab bar), buttons,
   toasts, loaders and empty states for the in-app pages
   (Discover, Matches, Profile).
============================================================= */

:root {
    --navy: #07111F;
    --bg: #FFF9FA;
    --surface: #FFFFFF;
    --surface-2: #F6F0F2;
    --text: #172033;
    --muted: #6B7689;
    --border: #EADFE2;

    --brand: #E85D75;
    --brand-dark: #D44662;
    --brand-soft: rgba(232, 93, 117, .12);
    --gradient: linear-gradient(135deg, #E94B72 0%, #F0636F 50%, #F7826A 100%);

    --like: #19C28C;
    --nope: #FF5266;
    --super: #2DA8F7;
    --gold: #F4B73F;

    --radius: 22px;
    --shadow-sm: 0 2px 10px rgba(7, 17, 31, .07);
    --shadow: 0 16px 44px rgba(7, 17, 31, .12);
    --shadow-brand: 0 10px 26px rgba(232, 93, 117, .38);

    --font-display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --nav-h: 58px;
    --tab-h: 64px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0C0D12;
        --surface: #161820;
        --surface-2: #1F222C;
        --text: #F2F3F7;
        --muted: #9AA1B3;
        --border: rgba(255, 255, 255, .09);
        --brand-soft: rgba(232, 93, 117, .18);
        --shadow-sm: 0 2px 10px rgba(0, 0, 0, .4);
        --shadow: 0 16px 44px rgba(0, 0, 0, .5);
    }
}

@media (min-width: 900px) {
    :root { --nav-h: 68px; }
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(var(--nav-h) + var(--safe-t));
    padding-bottom: calc(var(--tab-h) + var(--safe-b));
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.15;
    letter-spacing: -.02em;
}

a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

:focus-visible {
    outline: 3px solid var(--brand-soft);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--brand);
}

@media (min-width: 768px) {
    body { padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Layout ---------- */

.main,
.page {
    width: 100%;
    margin: 0 auto;
    padding: 18px 16px 28px;
}

.main { max-width: 1240px; }
.page { max-width: 980px; }

@media (min-width: 768px) {
    .main, .page { padding: 32px 32px 56px; }
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.page-header { margin-bottom: 20px; }

.page-header h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
}

.page-header p {
    margin: 0;
    max-width: 560px;
    color: var(--muted);
}

/* ---------- Top bar ---------- */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: calc(var(--nav-h) + var(--safe-t));
    padding: var(--safe-t) 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

/* Blur lives on a pseudo-element: backdrop-filter on .navbar itself would
   become the containing block of the fixed mobile tab bar inside it. */
.navbar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
}

@media (min-width: 900px) {
    .navbar { padding-left: 32px; padding-right: 32px; }
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 16px;
    background: var(--gradient);
    box-shadow: 0 6px 16px rgba(232, 93, 117, .35);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.04em;
    text-transform: lowercase;
}

.mobile-menu-button,
.mobile-nav { display: none !important; }

/* Mobile: primary navigation is a bottom tab bar */
.nav-links {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    height: calc(var(--tab-h) + var(--safe-b));
    padding: 6px 8px var(--safe-b);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border);
}

.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: color .2s ease, background .2s ease;
}

.nav-link i { font-size: 20px; }

.nav-link.active { color: var(--brand); }

.nav-link:active { background: var(--brand-soft); }

.nav-profile { display: none; }

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    transition: border-color .2s ease, color .2s ease;
}

.logout-btn span { display: none; }
.logout-btn:hover { color: var(--brand); border-color: var(--brand); }

@media (min-width: 768px) {
    .nav-links {
        position: static;
        height: auto;
        padding: 0;
        gap: 4px;
        flex: 1;
        justify-content: center;
        background: none;
        border: 0;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .nav-link {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 8px;
        padding: 10px 16px;
        border-radius: 999px;
        font-size: 14px;
    }

    .nav-link i { font-size: 15px; }
    .nav-link:hover { color: var(--text); background: var(--surface-2); }
    .nav-link.active { background: var(--brand-soft); }

    .nav-profile {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        margin-left: 10px;
        border-radius: 50%;
        color: #fff;
        font-weight: 800;
        text-transform: uppercase;
        background: var(--gradient);
        box-shadow: 0 6px 16px rgba(232, 93, 117, .32);
    }

    .logout-btn span { display: inline; }
}

/* ---------- Buttons ---------- */

.primary-btn,
.message-button,
.discover-button,
.refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .01em;
    text-decoration: none;
    background: var(--gradient);
    box-shadow: var(--shadow-brand);
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}

.primary-btn:hover,
.message-button:hover,
.discover-button:hover,
.refresh-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.primary-btn:active,
.message-button:active,
.discover-button:active,
.refresh-button:active { transform: scale(.97); }

.secondary-btn,
.profile-button,
.retry-button,
.refresh-button.secondary,
.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: none;
    transition: transform .15s ease, border-color .2s ease, color .2s ease;
}

.secondary-btn:hover,
.profile-button:hover,
.retry-button:hover,
.refresh-button.secondary:hover,
.back-btn:hover {
    color: var(--brand);
    border-color: var(--brand);
    transform: none;
    filter: none;
}

.secondary-btn:active,
.profile-button:active,
.retry-button:active,
.back-btn:active { transform: scale(.97); }

.primary-btn[disabled],
.secondary-btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
    z-index: 1000;
    max-width: min(92vw, 420px);
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .3);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity .25s ease, transform .25s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error { background: #C0293C; }

@media (prefers-color-scheme: dark) {
    .toast { background: #2A2D39; }
    .toast.error { background: #B3243A; }
}

@media (min-width: 768px) {
    .toast { bottom: 28px; }
}

/* ---------- Loaders & empty states ---------- */

.loader,
.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 4px solid var(--brand-soft);
    border-top-color: var(--brand);
    animation: zl-spin .8s linear infinite;
}

@keyframes zl-spin { to { transform: rotate(360deg); } }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38vh;
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

.loading p { margin: 0; }
.loading-content { display: flex; flex-direction: column; align-items: center; }

.empty-state {
    margin: 0 auto;
    padding: 44px 24px;
    max-width: 560px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.empty-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--brand);
    font-size: 32px;
    background: var(--brand-soft);
}

.empty-state h2 { margin: 0 0 8px; font-size: 24px; font-weight: 800; }
.empty-state p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); }

.error-details {
    margin: 0 auto 14px;
    max-width: 420px;
    color: var(--nope);
    font-size: 13px;
    word-break: break-word;
}

.error-details:empty { display: none; }
