/* CompraVende 2026 — Master UI/UX System */
/* Fontes Locais Otimizadas para Performance 100% */

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap; /* Otimização FCP: Texto visível imediatamente */
    src: url('../fonts/plus-jakarta-sans-v12-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-v12-latin-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-v12-latin-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-v12-latin-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-v12-latin-800.woff2') format('woff2');
}

:root {
    --bg: #f4f7fe;
    --panel: #ffffff;
    --text: #1a1a1a;
    /* Ajuste de Contraste Profissional para nota 100 em Acessibilidade */
    --text-muted: #4a5568;
    --line: #e2e8f0;
    --pri: #6d28d9;
    --pri-grad: linear-gradient(135deg, #6d28d9 0%, #a855f7 100%);
    --pri-soft: #f5f3ff;
    --bad: #ef4444;
    --ok: #22c55e;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
}

/* RESET E BASE */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: 1300px; margin: 0 auto; padding: 0 20px; }

/* HEADER PREMIUM - Otimizado para evitar Layout Shift */
.top {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 1000;
    height: 75px; display: flex; align-items: center;
    contain: layout style;
}

.brand {
    font-size: 1.6rem; font-weight: 800; letter-spacing: -1.5px;
    text-decoration: none; color: var(--text);
}
.brand span { color: var(--pri); }

/* NAVEGAÇÃO DESKTOP */
.nav-desktop { display: flex; align-items: center; gap: 25px; }
.nav-desktop a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
    transition: color 0.2s;
}

/* HOVER só nos links “normais”, NÃO no botão */
.nav-desktop a:not(.btn):hover {
    color: var(--pri);
}

/* BOTTOM NAV (MOBILE) - Otimizado para performance de renderização */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; height: 75px; z-index: 2000;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    contain: layout size style;
}

@media (max-width: 768px) {
    .mobile-nav { display: flex; justify-content: space-around; align-items: center; }
    .nav-desktop, .top .btn-loc span { display: none; }
    body { padding-bottom: 85px; }
    .top { height: 65px; }
}

.nav-item { text-decoration: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.nav-item i { font-size: 22px; font-style: normal; }
.nav-item span { font-size: 11px; font-weight: 700; }
.nav-item.active { color: var(--pri); }

/* BOTÃO CENTRAL "+ ANUNCIAR" */
.nav-item-add {
    background: var(--pri-grad); color: #fff !important;
    width: 52px; height: 52px; border-radius: 50%;
    margin-top: -45px; display: flex; align-items: center; justify-content: center;
    border: 5px solid var(--bg); box-shadow: 0 10px 20px rgba(109, 40, 217, 0.4);
    font-size: 24px !important;
}

/* BOTÕES E CARDS */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 24px; border-radius: 14px; font-weight: 800;
    font-size: 14px; cursor: pointer; border: none; transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none; gap: 8px;
}
.btn.pri {
    background: var(--pri-grad);
    color: #fff;           /* texto sempre branco */
    box-shadow: 0 8px 15px rgba(109, 40, 217, 0.2);
}
.btn.pri:hover {
    color: #fff;           /* garante que o hover nunca puxe a cor roxa do menu */
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(109, 40, 217, 0.3);
}
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--text); }

.panel { background: #fff; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }

/* SISTEMA DE DRAWER (GAVETA) - Transição suave para evitar Reflow forçado */
.drawer {
    position: fixed; bottom: -100%; left: 0; right: 0;
    background: #fff; z-index: 3000; border-radius: 30px 30px 0 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 85vh; display: flex; flex-direction: column;
    will-change: transform;
}
.drawer.active { transform: translateY(-100%); }
@media (min-width: 768px) {
    .drawer { width: 400px; height: 100%; top: 0; bottom: 0; right: -400px; left: auto; border-radius: 0; border-left: 1px solid var(--line); transition: transform 0.4s ease; }
    .drawer.active { transform: translateX(-400px); }
}

.drawer-header { padding: 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 10; }
.drawer-content { flex: 1; overflow-y: auto; padding: 20px; }

/* INPUTS */
.in {
    width: 100%; padding: 15px; border-radius: 12px; border: 2px solid var(--line);
    background: #fff; font-weight: 600; transition: border-color 0.2s; outline: none;
}
.in:focus { border-color: var(--pri); box-shadow: 0 0 0 4px var(--pri-soft); }

/* GRADES DE RESULTADOS */
.results-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}
@media (min-width: 768px) {
    .results-grid-container { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
}

/* CARD DE PRODUTO INDIVIDUAL */
.item-card {
    text-decoration: none; color: inherit; display: flex; flex-direction: column;
    border-radius: 20px; border: 1px solid var(--line); background: #fff;
    overflow: hidden; height: 100%; transition: transform 0.3s, box-shadow 0.3s;
}
.item-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

/* GALERIA E LIGHTBOX */
.nav-arrow { transition: opacity 0.2s; opacity: 0.7; }
.nav-arrow:hover { opacity: 1; }
.thumb-item.active { border-color: var(--pri) !important; opacity: 1 !important; }

/* UTILITÁRIOS */
.text-gradient { background: var(--pri-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.muted { color: var(--text-muted); font-size: 14px; font-weight: 600; } /* Contraste e peso de fonte otimizados */
.sold-badge { position: absolute; top: 15px; left: 15px; background: var(--bad); color: #fff; padding: 6px 15px; border-radius: 50px; font-size: 11px; font-weight: 900; letter-spacing: 1px; }

/* FIX PARA IMAGENS RESPONSIVAS E LCP */
img { max-width: 100%; height: auto; display: block; content-visibility: auto; }

/* ===========================
   CHAT: mobile sem scroll no body
   rola apenas dentro do chat
   =========================== */
@media (max-width: 768px) {
    body.route-chat {
        height: 100dvh;
        overflow: hidden;
        padding-bottom: 0 !important; /* mata o scroll extra do menu fixo no chat */
    }

    body.route-chat .wrap {
        max-width: 100% !important;
        padding: 0 !important;
    }

    body.route-chat .chat-container {
        height: calc(100dvh - 65px - 75px) !important; /* top mobile (65) + bottom nav (75) */
        border-radius: 0 !important;
        margin: 0 !important;
    }

    body.route-chat #msgBox {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}
