/* Miami Motors - complementos ao Tailwind */
html { scroll-behavior: smooth; scroll-padding-top: 100px; }

/* Hero: escurece a esquerda para o texto ler bem */
.hero-bg { object-position: 78% 40%; }
video.hero-bg { object-position: center center; }
.hero-shade { background:
    linear-gradient(90deg, rgba(0, 0, 0, .97) 0%, rgba(0, 0, 0, .92) 40%, rgba(0, 0, 0, .55) 72%, rgba(0, 0, 0, .3) 100%),
    linear-gradient(0deg, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, 0) 40%); }
@media (max-width: 768px) { .hero-shade { background: rgba(0, 0, 0, .88); } }

.navlink { position: relative; padding: .25rem 0; transition: color .2s; }
.navlink::after { content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 3px; background: #E61A1F; transition: width .25s; }
.navlink:hover { color: #000000; }
.navlink:hover::after { width: 100%; }

/* ========================================================
   Header Avantgarde Style: Split Menu, Center Logo & Social
   ======================================================== */
.flex-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 80px;
    position: relative;
    box-sizing: border-box;
}

/* Coluna Esquerda: Busca desktop */
.flex-wrapper .left {
    display: flex;
    align-items: center;
    width: 120px;
    flex-shrink: 0;
}
.flex-wrapper .left-search {
    display: flex;
    align-items: center;
}
.flex-wrapper .left-search a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    color: #7E7E7E;
    transition: all .2s ease;
    text-decoration: none;
}
.flex-wrapper .left-search a:hover {
    color: #E61A1F;
    background-color: #f8fafc;
    transform: scale(1.08);
}

/* Coluna Central: Links Esquerda + Logo Central + Links Direita */
.flex-wrapper .center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.25rem;
    flex: 1;
}
.flex-wrapper .center-navigation {
    display: flex;
    align-items: center;
}
.flex-wrapper .center-navigation ul {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.flex-wrapper .center-navigation li a {
    font-family: 'Barlow', system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1e293b;
    text-decoration: none;
    position: relative;
    padding: 0.35rem 0;
    transition: color .2s ease;
    white-space: nowrap;
}
.flex-wrapper .center-navigation li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #E61A1F;
    transition: width .25s ease;
}
.flex-wrapper .center-navigation li a:hover {
    color: #E61A1F;
}
.flex-wrapper .center-navigation li a:hover::after {
    width: 100%;
}

.flex-wrapper .center-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 0.5rem;
}
.flex-wrapper .center-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.flex-wrapper .center-logo .header-logo-img {
    height: 48px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
    transition: transform .2s ease;
}
.flex-wrapper .center-logo a:hover .header-logo-img {
    transform: scale(1.02);
}

/* Coluna Direita: Busca mobile, Menu hambúrguer e Redes Sociais */
.flex-wrapper .right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    width: 120px;
    flex-shrink: 0;
}
.flex-wrapper .right-search {
    display: none;
}
.flex-wrapper .right-menu {
    display: none;
}
.flex-wrapper .right-social {
    display: flex;
    align-items: center;
}
.flex-wrapper .right-social ul {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.flex-wrapper .right-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #7E7E7E;
    transition: color .2s ease, transform .2s ease;
    text-decoration: none;
}
.flex-wrapper .right-social a:hover {
    color: #E61A1F;
    transform: scale(1.15);
}

/* Responsividade Mobile & Tablet (< 1024px) */
@media (max-width: 1023px) {
    .flex-wrapper {
        height: 70px;
        padding: 0 1rem;
    }
    .flex-wrapper .left {
        display: none;
    }
    .flex-wrapper .center-navigation {
        display: none;
    }
    .flex-wrapper .center {
        justify-content: flex-start;
        gap: 0;
    }
    .flex-wrapper .center-logo .header-logo-img {
        height: 38px;
        max-width: 170px;
    }
    .flex-wrapper .right {
        width: auto;
        gap: 0.75rem;
    }
    .flex-wrapper .right-social {
        display: none;
    }
    .flex-wrapper .right-search {
        display: flex;
        align-items: center;
    }
    .flex-wrapper .right-search a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 9999px;
        color: #7E7E7E;
        transition: color .2s ease;
        text-decoration: none;
    }
    .flex-wrapper .right-search a:hover {
        color: #000;
        background-color: #f1f5f9;
    }
    .flex-wrapper .right-menu {
        display: flex;
        align-items: center;
    }
    .flex-wrapper .right-menu button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        background: transparent;
        cursor: pointer;
        transition: background-color .2s ease, border-color .2s ease;
    }
    .flex-wrapper .right-menu button:hover,
    .flex-wrapper .right-menu button[aria-expanded="true"] {
        background-color: #f8fafc;
        border-color: #cbd5e1;
    }
}

/* ========================================================
   Modal de Simulação de Financiamento (#modal-simulacao)
   ======================================================== */
#modal-simulacao {
    animation: fadeInModal .25s ease-out;
}
#modal-simulacao > div {
    animation: scaleInModal .28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleInModal {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ========================================================
   Preloader Avantgarde Style (#main-preloader)
   ======================================================== */
#main-preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    z-index: 99999;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition-property: opacity, visibility;
    transition-duration: 0.9s;
    transition-timing-function: cubic-bezier(.5, 0, 0, 1);
    pointer-events: all;
    user-select: none;
    -webkit-user-select: none;
}

#main-preloader .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transition-property: opacity, transform;
    transition-duration: 0.9s;
    transition-timing-function: cubic-bezier(.5, 0, 0, 1);
    z-index: 1;
}

#main-preloader .logo-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#main-preloader .preloader-logo-img {
    width: 250px;
    max-width: 78vw;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0;
    transform: translateY(18px) scale(0.92);
    filter: drop-shadow(0 0 20px rgba(230, 26, 31, 0.2));
    transition: opacity 0.8s cubic-bezier(.5, 0, 0, 1), transform 0.8s cubic-bezier(.5, 0, 0, 1), filter 0.8s ease;
}

#main-preloader .logo-line {
    width: 0;
    height: 2px;
    margin-top: 18px;
    background: linear-gradient(90deg, transparent 0%, #E61A1F 50%, transparent 100%);
    border-radius: 9999px;
    box-shadow: 0 0 16px rgba(230, 26, 31, 0.8);
    transition: width 0.9s cubic-bezier(.5, 0, 0, 1);
}

/* Estado de entrada (Ready) */
#main-preloader.ready .preloader-logo-img {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 35px rgba(230, 26, 31, 0.5));
}
#main-preloader.ready .logo-line {
    width: 160px;
}

/* Estado de saída (Animate) - Dissolve e Scale Up idêntico à Avantgarde */
#main-preloader.animate {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#main-preloader.animate .logo {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.45);
}

@media (max-width: 1023px) {
    #main-preloader .preloader-logo-img {
        width: 195px;
    }
    #main-preloader.ready .logo-line {
        width: 130px;
    }
    #main-preloader.animate .logo {
        transform: translate(-50%, -50%) scale(1.25);
    }
}

@media (max-width: 380px) {
    #main-preloader .preloader-logo-img {
        width: 160px;
    }
    #main-preloader.ready .logo-line {
        width: 100px;
    }
}

/* Remoção definitiva */
#main-preloader.remove {
    pointer-events: none !important;
    display: none !important;
}

html.no-js #main-preloader {
    display: none !important;
}

/* Abas Comprar / Vender */
.ptab { display: flex; flex: 1; align-items: center; justify-content: center; gap: .6rem; padding: 1rem 1.25rem; font-size: .9rem; font-weight: 800; color: #64748b; border-bottom: 3px solid transparent; transition: color .2s, background .2s; cursor: pointer; }
.ptab:hover { color: #000000; }
.ptab.is-active { background: #fff; color: #000000; border-bottom-color: #E61A1F; }
@media (min-width: 640px) { .ptab { flex: none; min-width: 15rem; } }

/* Filtros de categoria */
.cat { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff; padding: .55rem 1rem; font-size: .85rem; font-weight: 700; color: #475569; transition: all .2s; cursor: pointer; }
.cat span { border-radius: .25rem; background: #f1f5f9; padding: 0 .4rem; font-size: .75rem; }
.cat:hover { border-color: #000000; color: #000000; }
.cat.is-active { border-color: #E61A1F; background: #E61A1F; color: #ffffff; }
.cat.is-active span { background: rgba(255, 255, 255, .25); color: #ffffff; }

.chip { display: inline-flex; align-items: center; gap: .35rem; border-radius: .25rem; background: #f1f5f9; padding: .3rem .6rem; }
.fav[aria-pressed="true"] { color: #ef4444; }
.fav[aria-pressed="true"] svg { fill: currentColor; }

.car.is-hidden { display: none; }

/* Cartão: barra no topo e faixa "Ver ficha" sobre a foto */
.car-bar { position: absolute; z-index: 10; top: 0; left: 0; right: 0; height: 4px; background: #E61A1F; transform: scaleX(0); transform-origin: left; transition: transform .35s ease; }
.car:hover .car-bar { transform: scaleX(1); }
.peek { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem; background: rgba(0, 0, 0, .82); color: #fff; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transform: translateY(100%); transition: transform .3s ease; }
.btn-detail:hover .peek, .btn-detail:focus-visible .peek { transform: none; }
.fav:active { transform: scale(.88); }

/* Galeria da página do veículo */
.g-thumb { position: relative; height: 4.5rem; width: 6.5rem; flex-shrink: 0; overflow: hidden; border-radius: .5rem; border: 2px solid transparent; opacity: .6; transition: all .2s; cursor: pointer; }
.g-thumb:hover { opacity: 1; }
.g-thumb.is-active { border-color: #E61A1F; opacity: 1; }
#g-thumbs { scrollbar-width: thin; }

/* Lenis: scroll nativo desligado e mapas continuam clicáveis */
html.lenis, html.lenis body { scroll-behavior: auto !important; }
.lenis.lenis-smooth iframe { pointer-events: auto; }

/* Linha de veículos (Seminovos / Premium) */
.linha { display: inline-flex; align-items: center; gap: .5rem; border-radius: .4rem; padding: .6rem 1.1rem; font-size: .85rem; font-weight: 800; color: #475569; transition: all .2s; cursor: pointer; }
.linha span { border-radius: .25rem; background: #f1f5f9; padding: 0 .4rem; font-size: .75rem; }
.linha:hover { color: #000; }
.linha.is-active { background: #000; color: #E61A1F; }
.linha.is-active span { background: rgba(230, 26, 31, .15); color: #E61A1F; }
.cat.is-empty { opacity: .4; }

/* Avaliações */
.rev-track { scrollbar-width: none; cursor: grab; }
.rev-track::-webkit-scrollbar { display: none; }
.rev-track.is-drag { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.rev.is-hidden { display: none; }
.rev-nav { display: flex; height: 3rem; width: 3rem; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, .25); border-radius: 9999px; color: #fff; transition: all .2s; cursor: pointer; }
.rev-nav:hover { border-color: #E61A1F; background: #E61A1F; color: #fff; }
.rev-chip { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid rgba(255, 255, 255, .25); border-radius: .4rem; padding: .45rem .9rem; font-size: .85rem; font-weight: 700; color: #e5e5e5; transition: all .2s; cursor: pointer; }
.rev-chip span { border-radius: .25rem; background: rgba(255, 255, 255, .12); padding: 0 .4rem; font-size: .75rem; }
.rev-chip:hover { border-color: #E61A1F; }
.rev-chip.is-active { border-color: #E61A1F; background: #E61A1F; color: #fff; }
.rev-chip.is-active span { background: rgba(255, 255, 255, .25); color: #fff; }
.car.is-in { animation: rise .4s ease backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.map-frame { filter: grayscale(.85) contrast(1.05); transition: filter .3s; }
article:hover .map-frame { filter: grayscale(0); }

.foot-social { display: flex; height: 2.5rem; width: 2.5rem; align-items: center; justify-content: center; border: 1px solid #cbd5e1; border-radius: 9999px; background: #fff; color: #475569; transition: all .2s; }
.foot-social:hover { border-color: #E61A1F; background: #E61A1F; color: #ffffff; }

#header.is-scrolled { box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .3); }
dialog { margin: auto; }
dialog[open] { animation: rise .25s ease both; }
@media (prefers-reduced-motion: reduce) { .car.is-in, dialog[open] { animation: none; } html { scroll-behavior: auto; } }

/* Card Mobile estilo Casa dos Carros */
.card-slide {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.card-slide .card-img-top {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}
.card-slide .card-body {
    padding: 12px;
}
.card-slide .card-title {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    margin: 0 0 4px 0;
    line-height: 1.25;
}
.card-slide .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.card-slide .row.mt-2 {
    margin-top: 8px;
}
.card-slide .col-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
}
.card-slide .col-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
}
.card-slide .col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
}
.card-slide .h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #000;
    margin: 0;
    line-height: 1.1;
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: .02em;
}

/* Carrossel mobile do catálogo (< 640px) */
@media (max-width: 639px) {
    #grid, .car-slider-track {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0 !important;
        padding: 10px 1.25rem 24px 1.25rem !important;
        margin-left: -1.25rem !important;
        margin-right: -1.25rem !important;
        scrollbar-width: none;
        cursor: grab;
    }
    #grid::-webkit-scrollbar, .car-slider-track::-webkit-scrollbar {
        display: none;
    }
    #grid.is-drag, .car-slider-track.is-drag {
        cursor: grabbing;
        scroll-snap-type: none;
        user-select: none;
    }
    #grid .car, .car-slider-track .car {
        flex: 0 0 176px !important;
        width: 176px !important;
        max-width: 176px !important;
        min-width: 176px !important;
        margin: 5px !important;
        scroll-snap-align: start;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    #grid .car:hover, .car-slider-track .car:hover {
        transform: none !important;
    }
    #grid .car.is-hidden, .car-slider-track .car.is-hidden {
        display: none !important;
    }
}
