/**
 * AGENT SHARED — Splash Screen + Unified Header
 * Included by all agent subpages for identity consistency.
 * Now supports light/vibrant identity backgrounds.
 */

/* ─── VARIABLES (match hub) ─── */
:root {
    --c-sites: #03E3E2;
    --c-sistemas: #00FCA0;
    --c-design: #E58E19;
    --c-cardapios: #E20138;
    --c-convites: #E2D408;

    /* Light BG per agent — applied via page-level class */
    --bg-sites: #B8FAF9;
    --bg-sistemas: #B4FFE0;
    --bg-design: #FFDCAB;
    --bg-cardapios: #FFBDCC;
    --bg-convites: #FFF8A8;

    --v-dark: #0a0a0a;
    --v-white: #FFFFFF;
    --font-main: 'Outfit', sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════ */

.splash {
    position: fixed; inset: 0; z-index: 99999;
    background: var(--v-dark);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash.is-hidden {
    opacity: 0; visibility: hidden;
    pointer-events: none;
}

.splash__avatar {
    width: clamp(200px, 30vw, 340px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 60px var(--splash-color, #03E3E2));
    animation: splashFloat 2s ease-in-out infinite;
}

@keyframes splashFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.02); }
}

.splash__sector {
    margin-top: 28px;
    font-family: var(--font-main);
    font-size: 0.68rem; font-weight: 900;
    letter-spacing: 6px; text-transform: uppercase;
    color: rgba(255,255,255,0.3);
}

.splash__title {
    margin-top: 8px;
    font-family: var(--font-main);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900; text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--splash-color, #03E3E2);
    text-shadow: 0 0 40px var(--splash-color, #03E3E2);
}

.splash__bar {
    margin-top: 40px; width: 160px; height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px; overflow: hidden;
}
.splash__bar-fill {
    width: 0; height: 100%;
    background: var(--splash-color, #03E3E2);
    border-radius: 3px;
    animation: splashLoad 1.6s var(--ease) forwards;
}
@keyframes splashLoad {
    0% { width: 0; }
    60% { width: 70%; }
    100% { width: 100%; }
}

.splash__status {
    margin-top: 14px;
    font-family: monospace;
    font-size: 0.6rem; letter-spacing: 2px;
    color: rgba(255,255,255,0.15);
    text-transform: uppercase;
}

/* ═══════════════════════════════════════
   UNIFIED HEADER — adapts to light bg
   ═══════════════════════════════════════ */

.hdr-agent {
    position: sticky; top: 0; left: 0; width: 100%;
    height: 72px; z-index: 9999;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.hdr-agent__brand { text-decoration: none; }
.hdr-agent__brand img { height: 28px; filter: brightness(0); }
.hdr-agent__nav {
    display: flex; align-items: center; gap: 24px;
}
.hdr-agent__link {
    color: rgba(0,0,0,0.35); text-decoration: none;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    transition: color 0.3s;
}
.hdr-agent__link:hover { color: var(--v-dark); }
.hdr-agent__link.is-active { color: var(--v-dark); }
.hdr-agent__cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 24px;
    background: var(--v-dark);
    border: none;
    border-radius: 4px; color: var(--v-white);
    text-decoration: none; font-size: 0.64rem; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase;
    transition: all 0.3s var(--ease);
}
.hdr-agent__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.hdr-agent__pulse {
    width: 7px; height: 7px;
    background: var(--c-sistemas); border-radius: 50%;
    animation: agPulse 2s ease infinite;
}
@keyframes agPulse {
    0%,100% { opacity:1; transform:scale(1); }
    50% { opacity:0.3; transform:scale(1.8); }
}

/* ─── GRAIN (subtle) ─── */
.grain-agent {
    position: fixed; inset: 0; z-index: 9998;
    pointer-events: none; opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 150px; mix-blend-mode: multiply;
}

/* ─── MOBILE ─── */
@media (max-width: 768px) {
    .hdr-agent { padding: 0 16px; height: 60px; }
    .hdr-agent__brand img { height: 22px; }
    .hdr-agent__link:not(.hdr-agent__cta) { display: none; }
    .hdr-agent__cta { padding: 9px 16px; font-size: 0.58rem; }
    .splash__avatar { width: clamp(160px, 50vw, 240px); }
}

/* ═══════════════════════════════════════
   PREMIUM OVERLAY — cursor, HUD, magnet
   ═══════════════════════════════════════ */

:root {
    --font-mono: "JetBrains Mono", "Courier New", monospace;
    --ease-power: cubic-bezier(0.77, 0, 0.18, 1);
}

@media (hover: hover) and (pointer: fine) {
    body.has-overlay { cursor: none; }
    body.has-overlay a, body.has-overlay button { cursor: none; }
}

.cursor {
    position: fixed; top: 0; left: 0;
    z-index: 100000; pointer-events: none;
}

.cursor.is-hidden { opacity: 0; }

.cursor__dot {
    position: fixed; top: 0; left: 0;
    width: 6px; height: 6px;
    background: #fff; border-radius: 999px;
    transform: translate3d(-50%, -50%, 0);
    transition: width 0.25s var(--ease), height 0.25s var(--ease);
    will-change: transform;
    mix-blend-mode: difference;
}

.cursor__ring {
    position: fixed; top: 0; left: 0;
    width: 36px; height: 36px;
    border: 1.5px solid #fff;
    border-radius: 999px;
    transform: translate3d(-50%, -50%, 0);
    transition: width 0.35s var(--ease-power), height 0.35s var(--ease-power), background 0.3s var(--ease);
    will-change: transform;
    mix-blend-mode: difference;
}

.cursor.is-link .cursor__dot { width: 0; height: 0; }
.cursor.is-link .cursor__ring { width: 56px; height: 56px; background: rgba(255,255,255,0.12); }
.cursor.is-cta  .cursor__dot { width: 0; height: 0; }
.cursor.is-cta  .cursor__ring { width: 84px; height: 84px; background: #fff; }

@media (hover: none) and (pointer: coarse) {
    .cursor { display: none; }
}

/* HUD overlay */
.hud {
    position: fixed; inset: 0;
    z-index: 9990; pointer-events: none;
    color: rgba(255,255,255,0.55);
    font-family: var(--font-mono);
    font-size: 0.62rem; letter-spacing: 2px; text-transform: uppercase;
}

.hud__bracket {
    position: absolute;
    width: 22px; height: 22px;
    border: 1.5px solid var(--hud-accent, var(--c-sites));
}
.hud__bracket--tl { top: 86px; left: 16px; border-right: 0; border-bottom: 0; }
.hud__bracket--tr { top: 86px; right: 16px; border-left: 0; border-bottom: 0; }
.hud__bracket--bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.hud__bracket--br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }

.hud__row {
    position: absolute;
    display: flex; align-items: center; gap: 14px;
}
.hud__row--bl { bottom: 50px; left: 28px; }
.hud__row--br { bottom: 50px; right: 28px; }

.hud__pill {
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 2px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.72);
    font-weight: 700;
}

.hud__live {
    color: var(--c-sistemas);
    border-color: color-mix(in srgb, var(--c-sistemas) 60%, transparent);
    background: rgba(0,0,0,0.55);
}
.hud__live::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    margin-right: 7px;
    border-radius: 999px;
    background: var(--c-sistemas);
    box-shadow: 0 0 6px var(--c-sistemas);
    animation: hudPulse 1.2s ease-in-out infinite;
    vertical-align: middle;
    transform: translateY(-1px);
}

@keyframes hudPulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

.hud__signal {
    display: inline-flex; align-items: flex-end; gap: 2px; height: 10px;
}
.hud__signal span {
    display: block; width: 3px;
    background: var(--hud-accent, var(--c-sites));
}
.hud__signal span:nth-child(1) { height: 30%; }
.hud__signal span:nth-child(2) { height: 55%; }
.hud__signal span:nth-child(3) { height: 80%; }
.hud__signal span:nth-child(4) { height: 100%; opacity: 0.4; }

@media (max-width: 920px) {
    .hud { font-size: 0.52rem; letter-spacing: 1.4px; }
    .hud__bracket { width: 14px; height: 14px; top: 70px; left: 8px; }
    .hud__bracket--tr { right: 8px; left: auto; }
    .hud__bracket--bl { bottom: 8px; top: auto; }
    .hud__bracket--br { right: 8px; bottom: 8px; top: auto; left: auto; }
    .hud__row--bl { display: none; }
    .hud__row--br { right: 14px; bottom: 38px; }
    .hud__row--br .hud__pill:not(:last-child):not(:nth-last-child(2)) { display: none; }
}

/* Magnetic CTA */
.js-magnet {
    transform: translate(var(--mx, 0px), var(--my, 0px));
    transition: transform 0.4s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .splash { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   AGENT PAGES — MOBILE ELITE APP SHELL
   Safe areas · Glassmorphism · Touch · Native feel
   ═══════════════════════════════════════════════════════════ */

:root {
    --sai-top: env(safe-area-inset-top, 0px);
    --sai-bot: env(safe-area-inset-bottom, 20px);
    --sai-l:   env(safe-area-inset-left, 0px);
    --sai-r:   env(safe-area-inset-right, 0px);
}

/* ── Haptic press states ── */
@media (hover: none) and (pointer: coarse) {
    * { -webkit-tap-highlight-color: transparent; }

    a:active, button:active { opacity: 0.78; }

    .btn-nav:active,
    .fab-order:active,
    .filter-btn:active,
    .back-hub:active,
    .back-hub-nav:active,
    .hdr-agent__cta:active,
    .card:active {
        transform:  scale(0.96) !important;
        transition: transform 0.08s ease, opacity 0.08s ease !important;
    }

    .fab-order:active { transform: scale(0.93) !important; }

    .catalog-grid { -webkit-overflow-scrolling: touch; }

    body { overscroll-behavior-x: none; }
}

/* ── HUD brackets — all four corners ── */
@media (max-width: 920px) {
    .hud__bracket--tl { top:    calc(8px + var(--sai-top)); left:  calc(8px + var(--sai-l)); }
    .hud__bracket--tr { top:    calc(8px + var(--sai-top)); right: calc(8px + var(--sai-r)); }
    .hud__bracket--bl { bottom: calc(8px + var(--sai-bot)); left:  calc(8px + var(--sai-l)); }
    .hud__bracket--br { bottom: calc(8px + var(--sai-bot)); right: calc(8px + var(--sai-r)); }
    .hud__row--br     { bottom: calc(32px + var(--sai-bot)); }
}

/* ── FAB — safe area ── */
@media (max-width: 768px) {
    .fab-order {
        bottom: calc(20px + var(--sai-bot));
        right:  calc(20px + var(--sai-r));
    }
}

@media (max-width: 480px) {
    .fab-order {
        bottom: calc(14px + var(--sai-bot));
        right:  calc(14px + var(--sai-r));
        left:   calc(14px + var(--sai-l));
    }
}

/* ── Back-to-hub button ── */
@media (max-width: 768px) {
    .back-hub {
        top:  calc(18px + var(--sai-top));
        left: calc(14px + var(--sai-l));
    }
}

/* ── Agent header — glassmorphism + safe area ── */
@media (max-width: 768px) {
    .hdr-agent {
        padding-top:   calc(12px + var(--sai-top));
        padding-left:  calc(16px + var(--sai-l));
        padding-right: calc(16px + var(--sai-r));
        background:    rgba(5, 10, 14, 0.90) !important;
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
    }
}

/* ── Catalog top-nav header ── */
@media (max-width: 768px) {
    header.top-nav {
        background:     rgba(5, 10, 14, 0.90) !important;
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        padding-top:    calc(14px + var(--sai-top));
        padding-bottom: 14px;
        border-bottom:  1px solid rgba(255, 255, 255, 0.07) !important;
    }
}

/* ── iOS zoom prevention ── */
@media (max-width: 768px) {
    input, select, textarea { font-size: max(16px, 1rem) !important; }
    input::placeholder, textarea::placeholder { font-size: max(14px, 0.875rem); }
}

/* ── Catalog grid — single full-width column ── */
@media (max-width: 600px) {
    .catalog-grid {
        display:               grid !important;
        grid-template-columns: 1fr !important;
        overflow-x:            visible !important;
        padding:               20px 0 120px !important;
        gap:                   16px !important;
    }

    .card {
        width:       100% !important;
        flex-shrink: unset !important;
    }
}

/* ── Filter chips — horizontal scroll with snap ── */
@media (max-width: 480px) {
    .filter-section { padding: 12px 0 20px !important; }

    .filter-group {
        display:          flex !important;
        flex-wrap:        nowrap !important;
        justify-content:  flex-start !important;
        overflow-x:       auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width:  none;
        padding:          4px 16px 10px;
        margin:           0 -16px;
        gap:              8px !important;
    }

    .filter-group::-webkit-scrollbar { display: none; }

    .filter-btn {
        flex:             0 0 auto;
        scroll-snap-align: start;
        padding:          10px 18px !important;
        font-size:        0.7rem !important;
        clip-path:        none !important;
        border-radius:    99px !important;
        min-height:       42px;
        white-space:      nowrap;
    }

    .filter-btn.active {
        box-shadow: 0 0 14px color-mix(in srgb, var(--hud-accent, #E2D408) 45%, transparent);
    }
}

/* ── Catalog hero — compact ── */
@media (max-width: 600px) {
    .catalog-hero { padding: 28px 0 20px !important; }

    .catalog-hero h1 {
        font-size:      clamp(1.8rem, 9vw, 2.8rem) !important;
        letter-spacing: 2px !important;
        margin-bottom:  10px !important;
    }

    .catalog-hero p { font-size: 0.88rem !important; line-height: 1.5; }
}

/* ── Search bar — native feel ── */
@media (max-width: 600px) {
    .search-container input {
        border-radius: 12px !important;
        clip-path:     none !important;
        padding:       16px 16px 16px 48px !important;
        background:    rgba(255, 255, 255, 0.07) !important;
    }
}

/* ── Step form — native onboarding feel ── */
@media (max-width: 600px) {
    body { min-height: 100svh; }

    .form-container {
        padding-bottom: calc(100px + var(--sai-bot)) !important;
    }

    .progress-container {
        height:        3px !important;
        margin-bottom: 36px !important;
        border-radius: 99px !important;
        background:    rgba(255, 255, 255, 0.08) !important;
    }

    .progress-bar { border-radius: 99px !important; }

    .question {
        font-size:     1.25rem !important;
        margin-bottom: 28px !important;
        line-height:   1.3 !important;
    }

    input, select, textarea {
        clip-path:     none !important;
        border-radius: 12px !important;
        padding:       18px 18px 18px 54px !important;
        background:    rgba(255, 255, 255, 0.09) !important;
    }

    .btn-nav {
        clip-path:     none !important;
        border-radius: 14px !important;
        min-height:    56px !important;
    }

    .btn-prev {
        border-radius: 14px !important;
        min-height:    48px !important;
    }
}
