/* ==========================================================================
   AutoPro Institution - Responsive CSS
   Complete responsive layer: 360px, 390px, 480px, 768px, 1024px, 1280px, 1440px, 1920px
   ========================================================================== */

/* --- Ultra Large Screens (1920px+) --- */
@media (min-width: 1920px) {
    :root { --max-width: 1480px; }
    .hero-section { min-height: 700px; }
    .hero-title { font-size: 4.5rem; }
    .vehicle-grid { grid-template-columns: repeat(4, 1fr); }
    .features-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- Large Desktop (1440px - 1919px) --- */
@media (min-width: 1440px) and (max-width: 1919px) {
    :root { --max-width: 1320px; }
    .vehicle-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- Desktop (1280px - 1439px) --- */
@media (min-width: 1280px) and (max-width: 1439px) {
    :root { --max-width: 1200px; }
    .vehicle-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Small Desktop / Large Tablet (1024px - 1279px) --- */
@media (min-width: 1024px) and (max-width: 1279px) {
    :root { --max-width: 960px; }
    .vehicle-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-visual { right: -120px; width: 50%; }
    .search-grid { grid-template-columns: repeat(3, 1fr); }
    .search-grid-advanced { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
    .mega-menu { min-width: 600px; }
    .mega-menu-inner { grid-template-columns: repeat(3, 1fr); gap: var(--spacing-lg); }
}

/* --- Tablet Landscape (768px - 1023px) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    :root { --max-width: 720px; --header-height: 64px; }

    /* Header */
    .header-nav { display: none; }
    .header-mobile-toggle { display: flex; }
    .primary-menu { display: none; }
    .header-actions .header-account-btn span { display: none; }
    .header-actions .btn-cta span { display: inline; }
    .mega-menu { display: none; }

    /* Hero */
    .hero-section { min-height: auto; padding: var(--spacing-3xl) 0 var(--spacing-2xl); }
    .hero-content { max-width: 100%; }
    .hero-visual { right: -100px; width: 45%; opacity: 0.3; bottom: -20px; }
    .hero-title { font-size: clamp(1.75rem, 4vw, 2.5rem); }

    /* Search */
    .search-grid { grid-template-columns: repeat(2, 1fr); }
    .search-grid-advanced { grid-template-columns: repeat(3, 1fr); }
    .search-section { margin-top: -40px; padding: 0 var(--spacing-md); }

    /* Vehicle Grid */
    .vehicle-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .testimonials-grid { grid-template-columns: repeat(2, 1fr); }
    .brands-grid { grid-template-columns: repeat(6, 1fr); }

    /* Listing Detail */
    .vehicle-detail > div:nth-child(2) { grid-template-columns: 1fr 300px; gap: var(--spacing-xl); }
    .vehicle-specs-grid { grid-template-columns: repeat(3, 1fr); }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }

    /* CTA */
    .cta-section { padding: var(--spacing-3xl) 0; }

    /* Dashboard */
    .dashboard-container { grid-template-columns: 200px 1fr; }
    .dashboard-content [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
    .dashboard-content [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* --- Tablet Portrait (600px - 767px) --- */
@media (min-width: 600px) and (max-width: 767px) {
    :root { --max-width: 100%; --header-height: 60px; --spacing-4xl: 3rem; --spacing-3xl: 2.5rem; }

    .header-nav { display: none; }
    .header-mobile-toggle { display: flex; }
    .header-actions .btn-cta span { display: none; }
    .header-actions .header-account-btn span { display: none; }

    .hero-section { min-height: auto; padding: 3rem 0 2rem; }
    .hero-visual { display: none; }
    .hero-content { max-width: 100%; text-align: center; }
    .hero-title { font-size: 1.75rem; }
    .hero-subtitle { font-size: 1rem; margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .hero-stats { justify-content: center; gap: var(--spacing-lg); }

    .search-grid, .search-grid-advanced { grid-template-columns: 1fr; }
    .search-section { margin-top: -30px; padding: 0 var(--spacing-md); }

    .vehicle-grid { grid-template-columns: repeat(2, 1fr); gap: var(--spacing-md); }
    .features-grid { grid-template-columns: 1fr; }
    .testimonials-grid { grid-template-columns: 1fr; }
    .brands-grid { grid-template-columns: repeat(4, 1fr); }

    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }

    .vehicle-detail > div:nth-child(2) { grid-template-columns: 1fr; }
    .vehicle-specs-grid { grid-template-columns: repeat(2, 1fr); }

    .dashboard-container { grid-template-columns: 1fr; }
    .dashboard-sidebar { position: static; margin-bottom: var(--spacing-lg); }
    .dashboard-nav { display: flex; flex-wrap: wrap; gap: var(--spacing-xs); overflow-x: auto; }
    .dashboard-nav-item { flex-shrink: 0; }
    .dashboard-content [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
    .dashboard-content [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

    .mega-menu { display: none; }
    .cta-actions { flex-direction: column; align-items: center; }
}

/* --- Mobile Large (480px - 599px) --- */
@media (min-width: 480px) and (max-width: 599px) {
    :root { --max-width: 100%; --header-height: 60px; --spacing-4xl: 2.5rem; --spacing-3xl: 2rem; --spacing-2xl: 1.5rem; }

    .header-nav { display: none; }
    .header-mobile-toggle { display: flex; }
    .header-actions .btn-cta span { display: none; }
    .header-actions .header-account-btn span { display: none; }

    .hero-section { min-height: auto; padding: 2.5rem 0 1.5rem; }
    .hero-visual { display: none; }
    .hero-content { max-width: 100%; text-align: center; }
    .hero-title { font-size: 1.5rem; }
    .hero-subtitle { font-size: 0.95rem; margin-left: auto; margin-right: auto; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; }
    .hero-stats { justify-content: center; gap: var(--spacing-md); flex-wrap: wrap; }
    .hero-stat-number { font-size: 1.5rem; }

    .search-grid, .search-grid-advanced { grid-template-columns: 1fr; }
    .search-section { margin-top: -25px; padding: 0 var(--spacing-sm); }
    .search-panel { padding: var(--spacing-md); }
    .search-field-inline { grid-template-columns: 1fr 1fr; }

    .vehicle-grid { grid-template-columns: 1fr; max-width: 400px; margin-left: auto; margin-right: auto; }
    .features-grid { grid-template-columns: 1fr; }
    .testimonials-grid { grid-template-columns: 1fr; }
    .brands-grid { grid-template-columns: repeat(3, 1fr); gap: var(--spacing-sm); }

    .footer-grid { grid-template-columns: 1fr; gap: var(--spacing-xl); }
    .footer-brand { grid-column: auto; }
    .footer-bottom { flex-direction: column; text-align: center; gap: var(--spacing-md); }
    .footer-bottom-links { justify-content: center; flex-wrap: wrap; }

    .vehicle-detail > div:nth-child(2) { grid-template-columns: 1fr; }
    .vehicle-specs-grid { grid-template-columns: repeat(2, 1fr); }

    .dashboard-container { grid-template-columns: 1fr; }
    .dashboard-sidebar { position: static; margin-bottom: var(--spacing-md); }
    .dashboard-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; overflow-x: auto; }
    .dashboard-nav-item { font-size: 0.75rem; padding: 0.5rem 0.75rem; flex-shrink: 0; }
    .dashboard-content [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
    .dashboard-content [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

    .cta-actions { flex-direction: column; align-items: center; }
    .cta-title { font-size: var(--font-size-2xl); }
    .mega-menu { display: none; }

    /* Tables to cards */
    .autopro-comparison-table table, .autopro-comparison-table thead, .autopro-comparison-table tbody, .autopro-comparison-table th, .autopro-comparison-table td, .autopro-comparison-table tr { display: block; }
    .autopro-comparison-table thead tr { position: absolute; top: -9999px; left: -9999px; }
    .autopro-comparison-table tr { margin-bottom: 1rem; border: 1px solid var(--color-gray-200); border-radius: var(--radius-lg); }
    .autopro-comparison-table td { border: none; border-bottom: 1px solid var(--color-gray-100); position: relative; padding-left: 50%; text-align: left; }
    .autopro-comparison-table td:before { position: absolute; top: 0.75rem; left: 1rem; width: 45%; padding-right: 0.5rem; white-space: nowrap; font-weight: 700; color: var(--color-gray-500); }
    .autopro-comparison-table td:nth-of-type(1):before { content: "Prix"; }
    .autopro-comparison-table td:nth-of-type(2):before { content: "Année"; }
    .autopro-comparison-table td:nth-of-type(3):before { content: "Kilométrage"; }
    .autopro-comparison-table td:nth-of-type(4):before { content: "Carburant"; }
}

/* --- Mobile Medium (390px - 479px) --- */
@media (min-width: 390px) and (max-width: 479px) {
    :root { --max-width: 100%; --header-height: 56px; --spacing-4xl: 2rem; --spacing-3xl: 1.75rem; --spacing-2xl: 1.25rem; }

    .container { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }
    .header-nav { display: none; }
    .header-mobile-toggle { display: flex; }
    .header-actions .btn-cta span, .header-actions .btn-cta svg { display: none; }
    .header-actions .btn-cta { padding: 0.5rem; width: 44px; }
    .header-actions .header-account-btn span, .header-actions .header-account-btn svg { display: none; }
    .header-actions .header-account-btn { width: 44px; padding: 0.5rem; justify-content: center; }
    .site-logo span { font-size: 1rem; }
    .site-logo svg { width: 32px; height: 32px; }

    .hero-section { min-height: auto; padding: 2rem 0 1.25rem; }
    .hero-visual { display: none; }
    .hero-content { max-width: 100%; text-align: center; }
    .hero-title { font-size: 1.35rem; }
    .hero-subtitle { font-size: 0.875rem; margin-left: auto; margin-right: auto; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; }
    .hero-stats { justify-content: center; gap: var(--spacing-md); flex-wrap: wrap; }
    .hero-stat-number { font-size: 1.35rem; }
    .hero-stat-label { font-size: 0.65rem; }
    .hero-badge { font-size: 0.65rem; padding: 0.25rem 0.75rem; }

    .search-grid, .search-grid-advanced { grid-template-columns: 1fr; }
    .search-section { margin-top: -20px; padding: 0 var(--spacing-sm); }
    .search-panel { padding: var(--spacing-md); border-radius: var(--radius-lg); }
    .search-field-inline { grid-template-columns: 1fr 1fr; }
    .search-field label { font-size: 0.65rem; }
    .search-field select, .search-field input { height: 44px; font-size: 0.875rem; }

    .section { padding: var(--spacing-2xl) 0; }
    .section-title { font-size: 1.5rem; }
    .section-description { font-size: 0.9rem; }

    .vehicle-grid { grid-template-columns: 1fr; max-width: 380px; margin-left: auto; margin-right: auto; }
    .features-grid { grid-template-columns: 1fr; }
    .testimonials-grid { grid-template-columns: 1fr; }
    .brands-grid { grid-template-columns: repeat(3, 1fr); gap: var(--spacing-sm); }
    .brand-card { padding: var(--spacing-md) var(--spacing-sm); }
    .brand-card-icon { width: 36px; height: 36px; font-size: 1.1rem; }

    .vehicle-card-body { padding: var(--spacing-md); }
    .vehicle-card-specs { grid-template-columns: repeat(3, 1fr); gap: var(--spacing-xs); }
    .vehicle-spec { font-size: 0.7rem; }
    .vehicle-card-actions { flex-direction: column; }
    .vehicle-card-actions .btn { width: 100%; }

    .footer-grid { grid-template-columns: 1fr; gap: var(--spacing-lg); }
    .footer-brand { grid-column: auto; }
    .footer-bottom { flex-direction: column; text-align: center; gap: var(--spacing-sm); }
    .footer-bottom-links { justify-content: center; flex-wrap: wrap; gap: var(--spacing-md); }
    .footer-newsletter { flex-direction: column; }

    .vehicle-detail > div:nth-child(2) { grid-template-columns: 1fr; }
    .vehicle-specs-grid { grid-template-columns: repeat(2, 1fr); gap: var(--spacing-sm); }
    .vehicle-specs-grid > div { padding: var(--spacing-sm); }

    .dashboard-container { display: flex; flex-direction: column; }
    .dashboard-sidebar { position: static; margin-bottom: var(--spacing-md); }
    .dashboard-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.5rem; }
    .dashboard-nav-item { font-size: 0.7rem; padding: 0.4rem 0.6rem; flex-shrink: 0; }
    .dashboard-content [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
    .dashboard-content [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

    .cta-actions { flex-direction: column; align-items: center; }
    .cta-actions .btn { width: 100%; }
    .cta-title { font-size: 1.25rem; }
    .cta-section { padding: var(--spacing-2xl) 0; }

    .mega-menu { display: none; }
    .pagination .page-numbers { width: 36px; height: 36px; font-size: 0.75rem; }

    /* Listing page layout to single column */
    [style*="grid-template-columns:280px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:300px 1fr"] { grid-template-columns: 1fr !important; }

    table { font-size: 0.75rem; }
    table th, table td { padding: 0.5rem; }
}

/* --- Mobile Small (360px - 389px) --- */
@media (max-width: 389px) {
    :root { --max-width: 100%; --header-height: 52px; --spacing-4xl: 1.75rem; --spacing-3xl: 1.5rem; --spacing-2xl: 1rem; --spacing-xl: 0.75rem; --spacing-lg: 0.75rem; }

    .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .header-inner { padding: 0 0.75rem; gap: 0.5rem; }
    .header-nav { display: none; }
    .header-mobile-toggle { display: flex; width: 38px; height: 38px; }
    .header-actions { gap: 0.25rem; }
    .header-actions .btn-cta { padding: 0.375rem; width: 38px; min-height: 38px; }
    .header-actions .btn-cta span, .header-actions .btn-cta svg { display: none; }
    .header-actions .header-account-btn { width: 38px; padding: 0.375rem; min-height: 38px; }
    .header-actions .header-account-btn span, .header-actions .header-account-btn svg { display: none; }
    .header-search-toggle { width: 38px; height: 38px; }
    .site-logo svg { width: 28px; height: 28px; }
    .site-logo span { font-size: 0.9rem; }

    .hero-section { min-height: auto; padding: 1.5rem 0 1rem; }
    .hero-visual { display: none; }
    .hero-content { text-align: center; max-width: 100%; }
    .hero-badge { font-size: 0.6rem; padding: 0.2rem 0.6rem; }
    .hero-title { font-size: 1.2rem; }
    .hero-subtitle { font-size: 0.8rem; }
    .hero-actions { flex-direction: column; gap: 0.5rem; }
    .hero-actions .btn { width: 100%; font-size: 0.8rem; padding: 0.5rem 1rem; min-height: 40px; }
    .hero-stats { gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
    .hero-stat-number { font-size: 1.1rem; }
    .hero-stat-label { font-size: 0.6rem; }

    .search-section { margin-top: -15px; padding: 0 0.5rem; }
    .search-panel { padding: 0.75rem; border-radius: var(--radius-md); }
    .search-grid, .search-grid-advanced { grid-template-columns: 1fr; gap: 0.5rem; }
    .search-field label { font-size: 0.6rem; }
    .search-field select, .search-field input { height: 40px; font-size: 0.8rem; padding: 0 0.5rem; }
    .search-field-inline { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .search-field-inline input { height: 40px; }
    .search-submit .btn { height: 42px; font-size: 0.8rem; }
    .search-panel-title { font-size: 1rem; }
    .search-tab { padding: 0.35rem 0.75rem; font-size: 0.7rem; }

    .section { padding: 1.5rem 0; }
    .section-header { margin-bottom: 1.25rem; }
    .section-label { font-size: 0.6rem; }
    .section-title { font-size: 1.25rem; }
    .section-description { font-size: 0.8rem; }

    .vehicle-grid { grid-template-columns: 1fr; max-width: 340px; margin-left: auto; margin-right: auto; gap: 0.75rem; }
    .vehicle-card-image { aspect-ratio: 16/10; }
    .vehicle-card-body { padding: 0.75rem; }
    .vehicle-card-title { font-size: 0.85rem; }
    .vehicle-card-meta { font-size: 0.7rem; }
    .vehicle-price-main { font-size: 1rem; }
    .vehicle-card-specs { grid-template-columns: repeat(3, 1fr); gap: 0.25rem; padding-top: 0.75rem; }
    .vehicle-spec { font-size: 0.65rem; }
    .vehicle-card-actions { flex-direction: column; gap: 0.35rem; padding-top: 0.75rem; }
    .vehicle-card-actions .btn { width: 100%; font-size: 0.7rem; min-height: 34px; }
    .vehicle-badge { font-size: 0.6rem; padding: 0.15rem 0.5rem; }

    .features-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .feature-card { padding: 1rem; }
    .feature-card-icon { width: 42px; height: 42px; font-size: 1.1rem; margin-bottom: 0.75rem; }
    .feature-card h3 { font-size: 0.95rem; }
    .feature-card p { font-size: 0.75rem; }

    .testimonials-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .testimonial-card { padding: 1rem; }
    .testimonial-text { font-size: 0.75rem; }

    .brands-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .brand-card { padding: 0.5rem 0.25rem; }
    .brand-card-icon { width: 30px; height: 30px; font-size: 1rem; }
    .brand-card-name { font-size: 0.65rem; }
    .brand-card-count { font-size: 0.6rem; }

    .footer-grid { grid-template-columns: 1fr; gap: 1rem; }
    .footer-col h4 { font-size: 0.75rem; margin-bottom: 0.75rem; }
    .footer-col ul li a { font-size: 0.75rem; }
    .footer-brand p { font-size: 0.75rem; }
    .footer-bottom { flex-direction: column; text-align: center; gap: 0.5rem; font-size: 0.65rem; }
    .footer-bottom-links { justify-content: center; flex-wrap: wrap; gap: 0.75rem; font-size: 0.65rem; }
    .footer-newsletter { flex-direction: column; }
    .footer-newsletter input { height: 40px; font-size: 0.8rem; }
    .footer-newsletter .btn { height: 40px; }
    .footer-social a { width: 34px; height: 34px; }

    .vehicle-detail > div:nth-child(2) { grid-template-columns: 1fr; gap: 1rem; }
    .vehicle-specs-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .vehicle-specs-grid > div { padding: 0.5rem; }
    .vehicle-specs-grid > div > div:first-child { font-size: 0.6rem; }
    .vehicle-specs-grid > div > div:last-child { font-size: 0.8rem; }

    .dashboard-container { display: flex; flex-direction: column; }
    .dashboard-sidebar { position: static; margin-bottom: 0.75rem; }
    .dashboard-nav { display: flex; flex-wrap: wrap; gap: 0.2rem; overflow-x: auto; padding-bottom: 0.35rem; }
    .dashboard-nav-item { font-size: 0.65rem; padding: 0.3rem 0.5rem; flex-shrink: 0; }
    .dashboard-content [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
    .dashboard-content [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: 1fr !important; }

    .cta-section { padding: 1.5rem 0; border-radius: var(--radius-lg) !important; }
    .cta-title { font-size: 1.1rem; }
    .cta-description { font-size: 0.8rem; }
    .cta-actions { flex-direction: column; gap: 0.5rem; }
    .cta-actions .btn { width: 100%; }

    .btn { font-size: 0.75rem; padding: 0.45rem 1rem; min-height: 38px; }
    .btn-lg { font-size: 0.85rem; padding: 0.65rem 1.25rem; min-height: 44px; }
    .btn-sm { font-size: 0.65rem; padding: 0.3rem 0.65rem; min-height: 32px; }

    .pagination .page-numbers { width: 32px; height: 32px; font-size: 0.7rem; margin: 0 1px; }
    .mega-menu { display: none; }
    .breadcrumbs { font-size: 0.65rem; padding: 0.5rem 0; }

    [style*="grid-template-columns:280px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:300px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.15rem !important; }
    h3 { font-size: 1rem !important; }

    table { font-size: 0.7rem; }
    table th, table td { padding: 0.4rem 0.5rem; }
    .entry-content { font-size: 0.9rem; }
}

/* --- Ensure no horizontal overflow anywhere --- */
html, body { max-width: 100vw; overflow-x: hidden; }
img, svg, video, canvas, iframe { max-width: 100%; }
pre, code, table { max-width: 100%; overflow-x: auto; }

/* AutoPro V1.0.1 — public completion responsive hardening */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
video,
iframe,
object,
embed {
    max-width: 100%;
}

.site-main,
.site-header,
.site-footer,
.header-inner,
.container,
.vehicle-card,
.feature-card,
.dashboard-container,
.autopro-article-card,
.autopro-action-panel {
    min-width: 0;
    max-width: 100%;
}

.container {
    width: 100%;
}

.entry-content,
.autopro-rich-page,
.autopro-guide-body,
.dashboard-content,
.vehicle-card-body {
    overflow-wrap: anywhere;
    word-break: normal;
}

.header-inner {
    width: 100%;
    gap: clamp(0.5rem, 1vw, 1.25rem);
}

.header-nav,
.primary-menu,
.header-actions {
    min-width: 0;
}

.header-actions .btn,
.header-account-btn {
    white-space: nowrap;
}

.mega-menu {
    max-width: min(1120px, calc(100vw - 32px));
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.vehicle-grid,
.features-grid,
.brand-grid {
    width: 100%;
    min-width: 0;
}

.vehicle-card-actions,
.hero-actions,
.footer-bottom,
.footer-bottom-links,
.footer-newsletter {
    flex-wrap: wrap;
}

.vehicle-card-actions .btn {
    flex: 1 1 auto;
    min-width: min(100%, 130px);
}

.autopro-listing-intro {
    margin: 0 0 var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    color: var(--color-gray-700);
    line-height: 1.7;
}

.autopro-page-lead {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--color-gray-600);
    line-height: 1.75;
    margin-bottom: var(--spacing-xl);
}

.autopro-rich-page,
.autopro-guide-detail {
    max-width: 1100px;
    margin-inline: auto;
}

.autopro-public-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.autopro-public-grid > article,
.autopro-article-card,
.autopro-action-panel {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 2rem);
    box-shadow: var(--shadow-sm);
}

.autopro-action-panel {
    margin-top: var(--spacing-xl);
    text-align: center;
}

.autopro-kicker {
    display: inline-flex;
    align-items: center;
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.autopro-article-card {
    max-width: 920px;
    margin-inline: auto;
}

.autopro-article-card h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.08;
    margin-bottom: 1rem;
}

.autopro-guide-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-gray-700);
}

.autopro-guide-body ul {
    padding-left: 1.25rem;
}

.autopro-comparison-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.autopro-comparison-table table,
.dashboard-content table {
    min-width: 680px;
}

@media (max-width: 1180px) {
    .header-nav {
        display: none;
    }

    .header-actions .btn-cta span,
    .header-account-btn span {
        display: none;
    }
}

@media (max-width: 900px) {
    .autopro-public-grid,
    [style*="grid-template-columns:1fr 380px"],
    [style*="grid-template-columns:280px 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns:repeat(3,1fr)"],
    [style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-column:span 2"] {
        grid-column: span 1 !important;
    }

    .dashboard-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: var(--spacing-lg) !important;
    }

    .dashboard-sidebar,
    .dashboard-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    .dashboard-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .vehicle-specs-grid,
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .vehicle-detail [style*="position:sticky"] {
        position: static !important;
    }
}

@media (max-width: 640px) {
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .header-inner {
        padding-inline: 1rem;
    }

    .site-logo span {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions {
        gap: 0.35rem;
    }

    .header-search-toggle,
    .header-mobile-toggle,
    .header-account-btn {
        min-width: 42px;
        width: 42px;
        height: 42px;
        padding: 0 !important;
    }

    .mobile-menu {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    .hero-actions,
    .vehicle-card-actions,
    .footer-newsletter,
    .newsletter-section form,
    .search-form-row,
    .search-form-grid {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .btn,
    .vehicle-card-actions .btn,
    .footer-newsletter input,
    .footer-newsletter button,
    .newsletter-section input,
    .newsletter-section button {
        width: 100%;
    }

    .vehicle-grid,
    .features-grid,
    .brand-grid,
    [style*="grid-template-columns:repeat(auto-fill,minmax(280px,1fr))"] {
        grid-template-columns: 1fr !important;
    }

    .vehicle-specs-grid,
    [style*="grid-template-columns:repeat(2,1fr)"],
    [style*="grid-template-columns:repeat(2, minmax(0, 1fr))"] {
        grid-template-columns: 1fr !important;
    }

    .dashboard-nav {
        grid-template-columns: 1fr;
    }

    .dashboard-content,
    .dashboard-content > div,
    .feature-card,
    .vehicle-card,
    .search-panel,
    .autopro-article-card,
    .autopro-action-panel {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .dashboard-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ==========================================================================
   Desktop mega menu viewport guard - Acheter / Vendre
   Keeps dropdowns fully inside the screen without altering mobile menu.
   ========================================================================== */
@media (min-width: 1024px) {
    .site-header {
        overflow: visible;
    }

    .primary-menu > li.menu-item-has-children {
        position: static;
    }

    .primary-menu > li.menu-item-has-children > .mega-menu {
        position: fixed;
        top: var(--header-height);
        left: 50%;
        right: auto;
        width: min(1040px, calc(100vw - 48px));
        min-width: 0;
        max-width: calc(100vw - 48px);
        max-height: calc(100vh - var(--header-height) - 24px);
        overflow-x: hidden;
        overflow-y: auto;
        transform: translate3d(-50%, 10px, 0);
        scrollbar-width: thin;
    }

    .primary-menu > li.menu-item-has-children:hover > .mega-menu,
    .primary-menu > li.menu-item-has-children:focus-within > .mega-menu {
        transform: translate3d(-50%, 0, 0);
    }

    .primary-menu > li.menu-item-has-children > .mega-menu .mega-menu-inner {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .primary-menu > li.menu-item-has-children:nth-child(2) > .mega-menu {
        width: min(720px, calc(100vw - 48px));
    }

    .primary-menu > li.menu-item-has-children:nth-child(2) > .mega-menu .mega-menu-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mega-menu-column,
    .mega-menu-column ul,
    .mega-menu-column li,
    .mega-menu-column a {
        min-width: 0;
        max-width: 100%;
    }

    .mega-menu-column a {
        overflow-wrap: anywhere;
    }
}

@media (min-width: 1024px) and (max-width: 1120px) {
    .primary-menu > li.menu-item-has-children > .mega-menu {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        padding: var(--spacing-lg);
    }

    .primary-menu > li.menu-item-has-children > .mega-menu .mega-menu-inner {
        gap: var(--spacing-lg);
    }
}

/* Dashboard particulier final mobile guard */
@media (max-width: 900px) {
    .dashboard-private .dashboard-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        grid-template-columns: none;
    }

    .dashboard-private .dashboard-nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .dashboard-private .dashboard-nav {
        display: flex;
        grid-template-columns: none;
    }
}
