/* General Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8fafc;
}

.font-gothic {
    font-family: 'UnifrakturMaguntia', cursive;
}

.car-card {
    transition: all 0.3s ease;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.badge-new {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
    color: #000;
}

.btn-whatsapp {
    background-color: #25D366;
}

.btn-whatsapp:hover {
    background-color: #1ebc57;
}

/* Desktop scrollbar */
::-webkit-scrollbar {
    width: 8px;
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}


/* New Animations */
@keyframes slowZoom {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

.animate-slowZoom {
    animation: slowZoom 6s ease-in-out infinite alternate;
}

/* Typewriter Effect */
@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: #fbbf24
    }

    /* yellow-400 */
}

.typewriter h1 {
    overflow: hidden;
    /* Ensures the content is not revealed until the animation */
    border-right: .15em solid #fbbf24;
    /* The typwriter cursor */
    white-space: nowrap;
    /* Keeps the content on a single line */
    margin: 0;
    /* Gives that scrolling effect as the typing happens */
    letter-spacing: .05em;
    /* Adjust as needed */
    animation:
        typing 3.5s steps(35, end) forwards,
        blink-caret .75s step-end infinite;
    max-width: fit-content;
    min-width: 0; /* NEW: prevents header overflow cut-off */
}

/* Professional Logo Glow Animation */
@keyframes logo-glow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(234, 179, 8, 0.4), 0 0 30px rgba(234, 179, 8, 0.2);
        border-color: rgba(234, 179, 8, 0.6);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 25px rgba(234, 179, 8, 0.7), 0 0 50px rgba(234, 179, 8, 0.4);
        border-color: rgba(255, 215, 0, 1);
        transform: scale(1.05);
    }
}

/* Extracted from inline styles */
.logo-glow-anim {
    animation: logo-glow 3s infinite ease-in-out;
}


/* Typewriter Effect pour le Titre */
@keyframes text-typewriter {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

@keyframes text-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: #FBBF24
    }
}

.typewriter-text {
    display: inline-block;
    overflow: hidden;
    /* Allows wrapping for longer titles */
    white-space: normal;
    margin: 0 auto;
    /* Gives that scrolling effect as the typing happens */
    letter-spacing: .05em;
    /* Adjust as needed */
    /* Using steps(45) fits roughly with 'Roulez sans limites, vivez l’expérience premium' length */
    animation:
        text-typewriter 4.5s steps(45, end) infinite alternate,
        text-caret .75s step-end infinite;
}

/* Zoom Breathing Effect pour le Sous-titre */
@keyframes text-breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
        text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
    }
}

.animate-text-breathe {
    animation: text-breathe 4s ease-in-out infinite;
}

/* ===================================================
   ADAPTIVE LAYOUT — Desktop / Tablet / Mobile
   Detection: CSS media queries (screen width)
   JS detects device class and applies data-layout attribute
   =================================================== */

/* ---------- BASE (shared all breakpoints) ---------- */
html {
    background-color: #0f172a;
    min-height: 100vh;
}

body {
    width: 100%;
    max-width: none;
    background-color: #f8fafc;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Undo Tailwind space-y children margin — grid handles spacing */
#cars-container>* {
    margin-top: 0 !important;
}

/* Modal always centered regardless of breakpoint */
#car-modal>div {
    max-width: 640px;
    margin: 0 auto;
    height: 100%;
}

#car-modal .fixed.bottom-0 {
    max-width: 640px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* ====================================================
   📱 MOBILE  — max 767px
   Single column, compact spacing, hidden scrollbar
   ==================================================== */
@media (max-width: 767px) {

    /* No decorative scrollbar on mobile */
    ::-webkit-scrollbar {
        width: 0;
        background: transparent;
    }

    /* Unlock max-w-xl Tailwind cap */
    .max-w-xl {
        max-width: 100% !important;
    }

    /* Header */
    header>div {
        max-width: 100% !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    header h1 {
        font-size: 1.1rem !important;
    }

    /* Hero Slider — compact */
    #hero-slider {
        max-width: 100% !important;
        height: 220px !important;
        margin-bottom: 0 !important;
    }

    #hero-slider .slide-content h2 {
        font-size: 1.4rem !important;
    }

    /* Filter bar */
    .filter-bar-wrapper {
        max-width: 100% !important;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .filter-btn {
        font-size: 0.72rem !important;
        padding: 0.35rem 0.85rem !important;
    }

    /* Catalogue — 1 column */
    #cars-container {
        padding: 1rem 0.75rem 6rem 0.75rem !important;
    }
    
    .car-card .relative.h-56 {
        height: 224px !important;
    }
}

/* ====================================================
   📟 TABLET  — 768px → 1023px
   2-column grid, medium spacing
   ==================================================== */
@media (min-width: 768px) and (max-width: 1023px) {

    ::-webkit-scrollbar {
        width: 6px;
        background: #1e293b;
    }

    ::-webkit-scrollbar-thumb {
        background: #475569;
        border-radius: 4px;
    }

    /* Container adjustments removed to favor Tailwind grid */

    header>div {
        max-width: 100% !important;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    header h1 {
        font-size: 1.35rem !important;
    }

    #hero-slider {
        max-width: 100% !important;
        height: 320px !important;
        margin-bottom: 0 !important;
    }

    #hero-slider .slide-content h2 {
        font-size: 1.9rem !important;
    }

    .filter-bar-wrapper {
        max-width: 100% !important;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .filter-btn {
        font-size: 0.8rem !important;
        padding: 0.45rem 1rem !important;
    }

    /* Catalogue — 2 columns */
    /* Grid settings moved to Tailwind classes */
    #cars-container {
        padding: 1.25rem 1.5rem 5rem 1.5rem !important;
    }

    .car-card .relative.h-56 {
        height: 224px !important;
    }
}

/* ====================================================
   🖥️  DESKTOP — 1024px and above
   4-column grid, large spacing, full desktop experience
   ==================================================== */
@media (min-width: 1024px) {

    /* Styled scrollbar for desktop */
    ::-webkit-scrollbar {
        width: 8px;
        background: #1e293b;
    }

    ::-webkit-scrollbar-thumb {
        background: #475569;
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #64748b;
    }

    /* Container adjustments removed to favor Tailwind grid */

    header>div {
        max-width: 100% !important;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }

    header h1 {
        font-size: 1.75rem !important;
    }

    /* Larger logo on desktop */
    header img.logo-glow-anim {
        height: 5rem !important;
    }

    #hero-slider {
        max-width: 100% !important;
        height: 440px !important;
        margin-bottom: 0 !important;
    }

    #hero-slider .slide-content h2 {
        font-size: 2.6rem !important;
    }

    #hero-slider .slide-content p {
        font-size: 1rem !important;
    }

    .filter-bar-wrapper {
        max-width: 100% !important;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }

    .filter-btn {
        font-size: 0.875rem !important;
        padding: 0.5rem 1.4rem !important;
    }

    /* Catalogue — 4 columns */
    /* Grid settings moved to Tailwind classes */
    #cars-container {
        padding: 1.5rem 2.5rem 5rem 2.5rem !important;
    }

    .car-card .relative.h-56 {
        height: 224px !important;
    }

    /* Card hover lift — only on desktop where precise mouse exists */
    .car-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.15);
    }
}

/* Slider Animations - Pro Ken Burns Effect */
.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    overflow: hidden;
    isolation: isolate; /* NEW: prevents z-index bleed from child elements */
}

.slide.active {
    opacity: 1;
    z-index: 5;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Base Transition for transform */
    transition: transform 6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    display: block; /* Eliminates bottom gap caused by inline baseline */
    position: relative;
    z-index: 1;
}

/* ZOOM IN: Start 1.0 -> End 1.15 */
.slide.zoom-in img {
    transform: scale(1);
}

.slide.zoom-in.active img {
    transform: scale(1.15);
}

/* ZOOM OUT: Start 1.15 -> End 1.0 */
.slide.zoom-out img {
    transform: scale(1.15);
}

.slide.zoom-out.active img {
    transform: scale(1);
}

.slide-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 20;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s ease-out 0.3s;
    /* Delay for text */
}

.slide.active .slide-content {
    transform: translateY(0);
    opacity: 1;
}


/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}