/* ==========================================
   MOTOPEÇAS JÁ — ESTILO APP FUTURISTA
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

:root {
    --laranja: #ff6b35;
    --laranja-glow: #ff8c42;
    --roxo: #7c3aed;
    --azul: #2563eb;
    --grad-primario: linear-gradient(135deg, #ff6b35 0%, #f43f5e 50%, #7c3aed 100%);
    --grad-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #4c1d95 100%);
    --escuro: #0f172a;
    --escuro-2: #1e293b;
    --cinza-bg: #f8fafc;
    --cinza-texto: #64748b;
    --borda: rgba(148, 163, 184, 0.15);
    --branco-vidro: rgba(255, 255, 255, 0.85);
    --radius: 20px;
    --radius-sm: 14px;
    --shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 20px 40px -5px rgba(15, 23, 42, 0.15);
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--cinza-bg);
    color: var(--escuro);
    line-height: 1.55;
    font-size: 15px;
    padding-bottom: 90px;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ==========================================
   TOPO — GLASSMORPHISM FIXO
   ========================================== */
.topo {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 0;
}

.topo-linha {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    font-size: 18px;
    font-weight: 800;
    background: var(--grad-primario);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.busca-topo {
    flex: 1;
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    height: 42px;
    transition: all 0.3s;
}

.busca-topo:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--laranja);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.15);
}

.busca-topo input {
    flex: 1;
    border: none;
    padding: 0 16px;
    font-size: 14px;
    outline: none;
    background: transparent;
    color: #fff;
}

.busca-topo input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.busca-topo button {
    background: var(--grad-primario);
    border: none;
    color: #fff;
    padding: 0 18px;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.busca-topo button:active {
    opacity: 0.8;
}

/* ==========================================
   HERO — BANNER COM GLOW
   ========================================== */
.hero {
    position: relative;
    background: var(--grad-hero);
    color: #fff;
    padding: 40px 24px;
    border-radius: var(--radius);
    margin: 20px 0 32px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 20px 60px -15px rgba(124, 58, 237, 0.4);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 107, 53, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.5) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite;
}

@keyframes heroGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.hero h1 {
    position: relative;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero p {
    position: relative;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    max-width: 500px;
    margin: 0 auto;
}

/* ==========================================
   SEÇÕES
   ========================================== */
.secao { margin-bottom: 38px; }

.secao-titulo {
    font-size: 18px;
    font-weight: 800;
    color: var(--escuro);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.secao-titulo::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--grad-primario);
    border-radius: 2px;
}

/* ==========================================
   GRID MARCAS — CARDS ELEVADOS
   ========================================== */
.grid-marcas {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.card-marca {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 22px 12px;
    text-align: center;
    border: 1.5px solid var(--borda);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 140px;
    justify-content: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.card-marca::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad-primario);
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 0;
}

.card-marca > * { position: relative; z-index: 1; }

.card-marca:active {
    transform: scale(0.96);
    border-color: var(--laranja);
    box-shadow: 0 15px 30px -10px rgba(255, 107, 53, 0.3);
}

.card-marca img {
    max-height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.card-marca-icone {
    font-size: 38px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.card-marca h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--escuro);
}

.card-marca small {
    font-size: 12px;
    color: var(--cinza-texto);
    font-weight: 500;
}

/* ==========================================
   GRID CATEGORIAS — PILLS MODERNAS
   ========================================== */
.grid-categorias {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.card-categoria {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px solid var(--borda);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.card-categoria:active {
    transform: scale(0.97);
    border-color: var(--laranja);
}

.cat-icone {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cat-nome {
    font-weight: 700;
    font-size: 13px;
    flex: 1;
    color: var(--escuro);
}

.cat-total {
    background: var(--grad-primario);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}

/* ==========================================
   GRID PEÇAS — CARDS "PRODUTO DE APP"
   ========================================== */
.grid-pecas {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.card-peca {
    background: #fff;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--borda);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
}

.card-peca:active {
    transform: scale(0.97);
    border-color: var(--laranja);
}

.card-peca-img {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-peca-img::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 107, 53, 0.03) 0%, transparent 70%);
}

.card-peca-img img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.card-peca-info {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
}

.tag-cat {
    font-size: 10px;
    color: var(--laranja);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.card-peca-info h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--escuro);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
}

.descricao {
    font-size: 11px;
    color: var(--cinza-texto);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.preco {
    font-size: 18px;
    font-weight: 800;
    color: #059669;
    margin-top: auto;
    letter-spacing: -0.3px;
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.btn-comprar {
    display: block;
    text-align: center;
    background: var(--grad-primario);
    color: #fff;
    padding: 11px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 12px;
    margin-top: 6px;
    box-shadow: 0 4px 12px -2px rgba(255, 107, 53, 0.4);
    letter-spacing: 0.2px;
    transition: all 0.2s;
}

.btn-comprar:active {
    box-shadow: 0 2px 6px -2px rgba(255, 107, 53, 0.6);
    transform: translateY(1px);
}

/* ==========================================
   FILTROS CATEGORIA
   ========================================== */
.filtros-cat {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0 18px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.filtros-cat::-webkit-scrollbar { display: none; }

.filtro {
    white-space: nowrap;
    background: #fff;
    border: 1.5px solid var(--borda);
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cinza-texto);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filtro.ativo {
    background: var(--grad-primario);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 18px -4px rgba(255, 107, 53, 0.4);
}

.filtro:active {
    transform: scale(0.95);
}

/* ==========================================
   PÁGINA INDIVIDUAL DA PEÇA
   ========================================== */
.peca-detalhe {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1.5px solid var(--borda);
    box-shadow: var(--shadow);
}

.peca-detalhe-img {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.peca-detalhe-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.15));
    animation: floatImg 4s ease-in-out infinite;
}

@keyframes floatImg {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.sem-imagem { font-size: 48px; opacity: 0.3; }
.sem-imagem.grande { font-size: 90px; }

.peca-detalhe-info {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.peca-detalhe-info h1 {
    font-size: 21px;
    font-weight: 800;
    color: var(--escuro);
    line-height: 1.3;
    letter-spacing: -0.4px;
}

.modelo-ref {
    font-size: 13px;
    color: var(--cinza-texto);
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: 10px;
    display: inline-block;
    font-weight: 600;
}

.modelo-ref strong {
    color: var(--escuro);
    font-weight: 800;
}

.descricao-longa {
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

.preco-grande {
    font-size: 14px;
    color: var(--cinza-texto);
    margin: 8px 0;
}

.preco-grande strong {
    font-size: 28px;
    color: #059669;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.btn-comprar-grande {
    display: block;
    background: var(--grad-primario);
    color: #fff;
    padding: 18px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(255, 107, 53, 0.5);
    transition: all 0.2s;
    letter-spacing: 0.2px;
    margin-top: 8px;
}

.btn-comprar-grande:active {
    transform: translateY(2px);
    box-shadow: 0 5px 15px -5px rgba(255, 107, 53, 0.6);
}

.aviso-afiliado {
    font-size: 11px;
    color: var(--cinza-texto);
    text-align: center;
    margin-top: 4px;
}

/* ==========================================
   BREADCRUMB
   ========================================== */
.breadcrumb {
    font-size: 12px;
    color: var(--cinza-texto);
    padding: 16px 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    font-weight: 500;
}

.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb a { color: var(--laranja); font-weight: 600; }
.breadcrumb span { color: var(--escuro); font-weight: 600; }

/* ==========================================
   TÍTULOS
   ========================================== */
.titulo-pagina {
    font-size: 22px;
    font-weight: 800;
    color: var(--escuro);
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -0.5px;
}

/* ==========================================
   ESTADO VAZIO
   ========================================== */
.vazio {
    text-align: center;
    padding: 60px 20px;
    color: var(--cinza-texto);
    grid-column: 1 / -1;
    font-size: 14px;
}

/* ==========================================
   RODAPÉ
   ========================================== */
.rodape {
    background: var(--escuro);
    color: #94a3b8;
    text-align: center;
    padding: 28px 16px 90px;
    margin-top: 50px;
    font-size: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.aviso {
    font-size: 10px;
    color: #64748b;
    margin-top: 8px;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   BOTTOM NAV — ESTILO APP
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 200;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    min-width: 60px;
}

.bottom-nav a .nav-icone {
    font-size: 20px;
    transition: transform 0.2s;
}

.bottom-nav a:active .nav-icone {
    transform: scale(0.85);
}

.bottom-nav a.ativo {
    color: var(--laranja-glow);
}

.bottom-nav a.ativo .nav-icone {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.6));
}

/* ==========================================
   BOTÃO BUSCA FLUTUANTE (legado, escondido no app)
   ========================================== */
.busca-fixa {
    display: none;
}

/* ==========================================
   RESPONSIVO — TABLET
   ========================================== */
@media (min-width: 640px) {
    .grid-marcas { grid-template-columns: repeat(3, 1fr); }
    .grid-categorias { grid-template-columns: repeat(3, 1fr); }
    .grid-pecas { grid-template-columns: repeat(3, 1fr); }
    .hero { padding: 50px 30px; }
    .hero h1 { font-size: 30px; }
    .hero p { font-size: 15px; }
    .card-peca-img { height: 180px; }
    .titulo-pagina { font-size: 26px; }
}

/* ==========================================
   RESPONSIVO — DESKTOP
   ========================================== */
@media (min-width: 960px) {
    body {
        padding-bottom: 0;
    }

    .grid-marcas { grid-template-columns: repeat(4, 1fr); }
    .grid-categorias { grid-template-columns: repeat(4, 1fr); }
    .grid-pecas { grid-template-columns: repeat(4, 1fr); }

    .hero {
        padding: 70px 50px;
        margin: 30px 0 45px;
    }
    .hero h1 { font-size: 38px; }
    .hero p { font-size: 16px; }

    .card-marca {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .card-marca:hover {
        border-color: var(--laranja);
        transform: translateY(-4px);
        box-shadow: var(--shadow-hover);
    }
    .card-marca:hover::after {
        opacity: 0.03;
    }

    .card-peca {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .card-peca:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-hover);
        border-color: rgba(255, 107, 53, 0.3);
    }
    .card-peca:hover .card-peca-img img {
        transform: scale(1.08) rotate(-2deg);
    }

    .btn-comprar-grande:hover {
        transform: translateY(-2px);
        box-shadow: 0 15px 35px -5px rgba(255, 107, 53, 0.6);
    }

    /* Peça em 2 colunas no desktop */
    .peca-detalhe {
        display: grid;
        grid-template-columns: 1.1fr 1fr;
    }
    .peca-detalhe-img {
        height: 100%;
        min-height: 480px;
    }

    .bottom-nav { display: none; }
    .rodape { padding-bottom: 28px; }

    .topo { padding: 16px 0; }
    .logo { font-size: 20px; }
    .busca-topo { max-width: 500px; margin-left: auto; }
}

/* ==========================================
   ANIMAÇÃO DE ENTRADA
   ========================================== */
@media (prefers-reduced-motion: no-preference) {
    .card-marca, .card-peca, .card-categoria {
        animation: fadeInUp 0.4s ease-out backwards;
    }
    .card-marca:nth-child(1) { animation-delay: 0.02s; }
    .card-marca:nth-child(2) { animation-delay: 0.04s; }
    .card-marca:nth-child(3) { animation-delay: 0.06s; }
    .card-marca:nth-child(4) { animation-delay: 0.08s; }
    .card-marca:nth-child(5) { animation-delay: 0.10s; }
    .card-marca:nth-child(6) { animation-delay: 0.12s; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}