/* ========================================
   MOBILE RESPONSIVE STYLES - BS Custom
   Media queries pour mobile et tablette
   Sans modifier le style desktop
   ======================================== */

/* ==================== TABLETTES (768px - 980px) ==================== */
@media (max-width: 980px) and (min-width: 768px) {

  /* Container */
  .container {
    width: calc(100% - 32px);
  }

  /* Hero */
  .hero {
    min-height: 40vh;
    padding-top: 60px;
  }

  .hero-content {
    padding: 48px 20px;
  }

  .hero-title {
    font-size: 36px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  /* Sections */
  .section {
    padding: 60px 0;
  }

  /* Vehicle Grid - 2 colonnes sur tablette */
  .vehicles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  /* Filters */
  .filters {
    margin-top: 24px;
    gap: 8px;
  }

  .filter-btn {
    height: 36px;
    padding: 0 16px;
    font-size: 11px;
  }
}

/* ==================== MOBILES (max 980px) ==================== */
@media (max-width: 980px) {

  /* Root variables ajustées pour mobile */
  :root {
    --navH: 60px;
    --radius: 12px;
  }

  /* Container mobile */
  .container {
    width: calc(100% - 24px);
    margin: 0 auto;
  }

  /* Typography mobile */
  body {
    /* Ajout d'un padding en bas pour que le footer ne soit pas caché par la barre de nav mobile */
    padding-bottom: 120px;
  }

  /* Navigation Header - Simplifiée sur mobile */
  .nav {
    height: 60px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .nav-inner {
    gap: 12px;
  }

  .brand {
    min-width: auto;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 14px;
  }

  /* Cacher le menu desktop - navigation bottom prend le relais */
  .menu {
    display: none !important;
  }

  /* Hero Mobile */
  .hero {
    min-height: 50vh;
    padding-top: 60px;
  }

  .hero-content {
    padding: 40px 16px;
  }

  .hero-title {
    font-size: 28px;
    margin: 0 0 12px;
    line-height: 1.2;
  }

  .hero-subtitle {
    font-size: 13px;
    line-height: 1.5;
  }

  /* Sections mobile */
  .section {
    padding: 48px 0;
  }

  .intro h2 {
    font-size: 20px;
  }

  .intro .copy {
    font-size: 13px;
    margin-top: 12px;
  }

  /* Filters mobile - Scroll horizontal */
  .filters {
    margin-top: 20px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
    padding-bottom: 4px;
    justify-content: flex-start;
  }

  .filters::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .filter-btn {
    height: 38px;
    padding: 0 18px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Vehicle Grid - 1 colonne sur mobile */
  .vehicles-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Vehicle Card mobile - Optimisé pour touch */
  .vehicle-card {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  .vehicle-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .vehicle-media {
    height: 220px;
  }

  .badge {
    top: 10px;
    right: 10px;
    padding: 5px 9px;
    font-size: 9px;
  }

  .nav-arrow {
    width: 36px;
    height: 36px;
  }

  .vehicle-body {
    padding: 14px;
  }

  .vehicle-title {
    font-size: 15px;
  }

  .vehicle-desc {
    font-size: 12px;
    margin-top: 8px;
  }

  .price-row {
    margin-top: 10px;
    gap: 8px;
  }

  .price-main {
    font-size: 14px;
  }

  .reserve {
    margin-top: 12px;
  }

  .reserve .btn {
    height: 44px; /* Plus grand pour touch sur mobile */
    font-size: 12px;
  }

  /* Buttons mobile - Touch-friendly */
  .btn {
    height: 42px;
    padding: 0 20px;
    font-size: 11px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .btn:active {
    transform: scale(0.98);
  }

  /* Footer mobile */
  .footer {
    padding: 40px 0 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer h3 {
    font-size: 11px;
    margin: 0 0 10px;
  }

  .contact-box {
    padding: 12px;
  }

  .contact-line {
    font-size: 12px;
    margin-top: 8px;
  }

  .socials {
    margin: 12px 0;
    gap: 8px;
  }

  .socials .btn {
    height: 38px;
    padding: 0 14px;
    font-size: 10px;
  }

  .footer-bottom {
    margin-top: 24px;
    padding-top: 16px;
    font-size: 10px;
  }

  /* Divider mobile */
  .bs-divider {
    height: 40px;
  }

  .footer-divider {
    margin: 0 0 40px 0;
  }

  /* No vehicles message */
  .no-vehicles {
    margin-top: 20px;
    font-size: 13px;
    padding: 20px;
  }
}

/* ==================== TRÈS PETITS MOBILES (max 380px) ==================== */
@media (max-width: 380px) {

  .container {
    width: calc(100% - 20px);
  }

  .hero-title {
    font-size: 24px;
  }

  .hero-subtitle {
    font-size: 12px;
  }

  .intro h2 {
    font-size: 18px;
  }

  .vehicle-media {
    height: 200px;
  }

  .vehicle-title {
    font-size: 14px;
  }

  .reserve .btn {
    font-size: 11px;
  }

  .brand-name {
    display: none; /* Cacher le texte sur très petits écrans */
  }
}

/* ==================== MODAL RESPONSIVE ==================== */
@media (max-width: 767px) {

  /* Modal overlay */
  #modalOverlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  /* Modal container - Plein écran sur mobile */
  #modalOverlay > div {
    max-width: 100% !important;
    min-height: 85vh !important;
    max-height: 95vh !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    animation: slideUpModal 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  @keyframes slideUpModal {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* Modal header */
  #modalOverlay h2 {
    font-size: 20px !important;
    position: sticky !important;
    top: 0 !important;
    background: var(--card) !important;
    padding: 16px 16px 12px !important;
    margin: -16px -16px 16px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    z-index: 10 !important;
  }

  /* Modal close button */
  #closeModalBtn {
    width: 32px !important;
    height: 32px !important;
    top: 12px !important;
    right: 12px !important;
  }

  /* Modal content */
  #modalContent {
    padding: 16px !important;
    overflow-y: auto !important;
    max-height: calc(95vh - 80px) !important;
  }

  /* Modal grid items */
  #modalContent > div[style*="display:grid"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Modal buttons */
  #modalContent button {
    width: 100% !important;
    height: 48px !important;
    font-size: 12px !important;
  }

  /* Price summary mobile */
  #priceSummary {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--card) !important;
    margin: 16px -16px -16px !important;
    padding: 16px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    z-index: 10 !important;
  }

  #priceSummary button[type="submit"] {
    height: 50px !important;
    font-size: 13px !important;
  }
}

/* ==================== FLATPICKR MOBILE ==================== */
@media (max-width: 767px) {

  .flatpickr-calendar {
    max-width: calc(100vw - 32px) !important;
    font-size: 14px !important;
  }

  .flatpickr-day {
    height: 38px !important;
    line-height: 38px !important;
    max-width: 38px !important;
  }

  .flatpickr-months {
    padding: 8px 0 !important;
  }

  .flatpickr-current-month {
    font-size: 16px !important;
  }
}

/* ==================== TOUCH IMPROVEMENTS ==================== */
@media (max-width: 980px) {

  /* Désactiver le highlight sur touch */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  /* Améliorer les zones de touch */
  a, button, input, select, textarea {
    min-height: 44px; /* Recommandation Apple pour touch targets */
  }

  /* Smooth scroll */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* Empêcher le zoom sur les inputs */
  input, select, textarea {
    font-size: 16px !important; /* Empêche le zoom automatique sur iOS */
  }
}

/* ==================== LANDSCAPE MODE (Mobile horizontal) ==================== */
@media (max-width: 980px) and (orientation: landscape) {

  .hero {
    min-height: 60vh;
  }

  .hero-content {
    padding: 32px 16px;
  }

  .section {
    padding: 40px 0;
  }

  /* Modal en landscape */
  #modalOverlay > div {
    max-height: 90vh !important;
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .nav,
  .mobile-bottom-nav,
  .filters,
  .footer {
    display: none !important;
  }

  .hero {
    min-height: auto !important;
    padding: 20px 0 !important;
  }

  .vehicles-grid {
    grid-template-columns: 1fr !important;
  }
}
