/* ==========================================================================
   ISOCAD CONSULTING — FEUILLE DE STYLE RESPONSIVE MULTI-ÉCRANS
   Adaptation Mobile-First & Responsive Premium (320px à 1920px)
   Smartphones • Tablettes • Ordinateurs portables • Écrans larges
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. RÈGLES GLOBALES DE PRÉVENTION & ERGONOMIE MOBILE
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch;
}

/* Éviter tout débordement d'images, vidéos et iframes */
img, video, iframe, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* Zone tactile minimale recommandée (44px) pour l'accessibilité mobile */
a, button, input, select, textarea, .domain-card, .entrance-card, .check-option {
  -webkit-tap-highlight-color: rgba(2, 75, 153, 0.1);
}

/* Fix iOS Auto-Zoom : empêcher Safari de zoomer sur le focus des formulaires */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* --------------------------------------------------------------------------
   1. LAPTOPS & PETITS ÉCRANS DESKTOP (max-width: 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .nav-menu {
    gap: 0.85rem;
  }
  .nav-link {
    font-size: 0.82rem;
  }
  .header-actions {
    gap: 0.45rem;
  }
  .btn-header-formation {
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
  }
  .btn-header-ingenierie {
    padding: 0.45rem 0.95rem;
    font-size: 0.78rem;
  }
}

/* --------------------------------------------------------------------------
   2. TABLETTES PAYSAGE & GRANDS FORMATS MOBILES (max-width: 1040px)
   -------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  /* Header : transition vers menu hamburger */
  .nav-center-wrapper {
    display: none !important;
  }
  .btn-header-formation {
    display: none !important;
  }
  .btn-mobile-toggle,
  .header-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #FFFFFF;
    color: var(--color-primary-navy);
    cursor: pointer;
    transition: background var(--transition-fast);
  }

  /* Entrées 4 publics */
  .entrances-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem;
    margin-top: 1rem !important;
  }

  /* Domaines d'expertise : 2 colonnes */
  .domains-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem;
  }

  /* Solutions 3 colonnes */
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Page /formations : Sidebar filtres repliable */
  .catalog-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .catalog-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(340px, 86vw) !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 2500 !important;
    transform: translateX(-105%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 12px 0 35px rgba(10, 25, 47, 0.22) !important;
    border-radius: 0 16px 16px 0 !important;
    overflow-y: auto !important;
    background: #FFFFFF !important;
  }

  .catalog-sidebar.open {
    transform: translateX(0) !important;
  }

  /* Bouton mobile filtres */
  .btn-mobile-filters {
    display: inline-flex !important;
  }

  /* Overlay de fond pour sidebar filtres */
  .mobile-filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 47, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2400;
    display: none;
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .mobile-filters-overlay.open {
    display: block !important;
    opacity: 1 !important;
  }

  /* Footer 2 colonnes */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2.5rem 2rem !important;
  }
}

/* --------------------------------------------------------------------------
   3. TABLETTES PORTRAIT & SMARTPHONES STANDARDS (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Header Mobile Compact */
  .site-header {
    height: 62px !important;
  }
  .site-header.scrolled {
    height: 58px !important;
  }
  .header-inner {
    padding: 0 1rem;
  }
  .logo-img {
    height: 34px !important;
  }
  .site-header.scrolled .logo-img {
    height: 30px !important;
  }
  .btn-header-ingenierie {
    display: none !important;
  }
  .btn-header-wa {
    width: 38px !important;
    height: 38px !important;
  }

  /* Sections : Espacements et Titres fluides */
  .section {
    padding: 3.25rem 0 !important;
  }
  .section-header {
    margin-bottom: 2rem !important;
  }
  .section-title {
    font-size: clamp(1.65rem, 4.8vw, 2.15rem) !important;
    line-height: 1.25 !important;
  }
  .section-subtitle {
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
  }

  /* HERO SECTION */
  .hero-section {
    min-height: auto !important;
    padding: 6.5rem 1rem 3.5rem 1rem !important;
  }
  .hero-badge {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.8rem !important;
    margin-bottom: 1rem !important;
  }
  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem) !important;
    line-height: 1.15 !important;
    margin-bottom: 0.75rem !important;
  }
  .hero-slogan {
    font-size: clamp(1.05rem, 3.8vw, 1.35rem) !important;
    margin-bottom: 1.15rem !important;
  }
  .hero-description {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin-bottom: 1.75rem !important;
    max-width: 100% !important;
  }
  .hero-cta-group {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }
  .hero-cta-group .btn-cta-primary,
  .hero-cta-group .btn-cta-secondary,
  .hero-cta-group .btn-cta-tertiary {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    padding: 0.85rem 1.25rem !important;
    font-size: 0.88rem !important;
    min-height: 48px;
  }

  /* BARRE DE RECHERCHE & FILTRES DU CATALOGUE (Accueil) */
  .catalog-search-hero {
    padding: 1.5rem 1.2rem !important;
    border-radius: 16px !important;
  }
  .catalog-search-input-wrap {
    min-height: 48px !important;
  }
  .catalog-search-input {
    font-size: 0.92rem !important;
    padding: 0.75rem 0.85rem !important;
  }
  .catalog-filters-row {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    margin-top: 1rem !important;
  }
  .home-filter-select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    font-size: 0.85rem !important;
    padding: 0.65rem 0.8rem !important;
    border-radius: var(--radius-md) !important;
  }
  .filter-item:last-child {
    grid-column: span 2 !important;
  }
  .catalog-search-btn {
    width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
  }
  .catalog-search-footer {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.75rem !important;
    margin-top: 1.25rem !important;
  }
  .btn-catalog-explore {
    width: 100% !important;
    justify-content: center !important;
    min-height: 46px !important;
  }

  /* Solutions B2B & Conseil : 1 colonne empilée */
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  .solution-card {
    padding: 1.75rem 1.5rem !important;
  }
  .solution-card .btn {
    width: 100% !important;
    min-height: 46px;
  }

  /* Formulaire d'Ingénierie */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .form-group.col-span-2 {
    grid-column: span 1 !important;
  }
  .smart-form-card {
    padding: 1.75rem 1.25rem !important;
    border-radius: 16px !important;
  }
  .smart-form-card button[type="submit"] {
    width: 100% !important;
    min-height: 50px;
  }

  /* Prise de Rendez-vous */
  div[style*="grid-template-columns: 1.25fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .time-slots-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
  }
  .time-slot-btn {
    padding: 0.65rem 0.35rem !important;
    font-size: 0.82rem !important;
    min-height: 44px !important;
  }

  /* Contact & Localisation (Google Maps) */
  div[style*="grid-template-columns: 1.5fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.75rem !important;
  }
  #map-container {
    height: 280px !important;
    border-radius: 14px !important;
  }

  /* DOCK FLOTTANT SUR MOBILE */
  .floating-cta-dock {
    top: auto !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    right: 1rem !important;
    transform: none !important;
    gap: 0.5rem !important;
  }
  .floating-cta-item {
    max-width: 44px !important;
    padding: 0.45rem !important;
  }
  .floating-cta-item:active {
    transform: scale(0.94);
  }
  .floating-cta-icon {
    width: 32px !important;
    height: 32px !important;
  }
  .floating-cta-label {
    display: none !important;
  }

  /* SMART MODALES INTELLIGENTES EN FULLSCREEN / COMPACT */
  .smart-modal-backdrop {
    padding: 0.75rem !important;
    align-items: flex-end !important;
  }
  .smart-modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 88dvh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
  }
  .smart-modal-header {
    padding: 1.15rem 1.25rem 0.85rem 1.25rem !important;
  }
  .smart-modal-title {
    font-size: 1.2rem !important;
  }
  .smart-modal-subtitle {
    font-size: 0.82rem !important;
  }
  .smart-modal-body {
    padding: 1.15rem 1.25rem !important;
    max-height: calc(88dvh - 145px) !important;
  }
  /* Toutes les grilles 2 colonnes dans les modales se transforment en 1 colonne */
  .smart-modal-body div[style*="grid-template-columns: 1fr 1fr"],
  .smart-modal-body div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }
  .smart-modal-footer {
    padding: 0.85rem 1.25rem !important;
    gap: 0.5rem !important;
  }
  .smart-modal-footer .btn {
    min-height: 44px !important;
    font-size: 0.85rem !important;
  }

  /* PAGE /formations : Catalogue Dédié */
  .catalog-hero {
    padding: 5.5rem 0 2rem 0 !important;
  }
  .catalog-hero-title {
    font-size: 1.85rem !important;
  }
  .catalog-hero-subtitle {
    font-size: 0.92rem !important;
  }
  .catalog-results-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }
  .catalog-controls-right {
    justify-content: space-between !important;
    width: 100%;
  }
  .catalog-page-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  .custom-cta-inner {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1.25rem !important;
    padding: 1.75rem 1.25rem !important;
  }
  .custom-cta-inner .btn {
    width: 100% !important;
    min-height: 46px;
  }

  /* Fiche Détaillée Course Modal */
  .course-detail-dialog {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90dvh !important;
  }
  .course-detail-body {
    padding: 1.25rem 1rem !important;
  }
  .course-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .course-detail-cta-box {
    position: static !important;
    margin-top: 1rem !important;
  }

  /* Notifications Toast */
  .toast-container {
    top: calc(70px + env(safe-area-inset-top, 0px)) !important;
    left: 1rem !important;
    right: 1rem !important;
  }
  .toast-message {
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 0.86rem !important;
  }
}

/* --------------------------------------------------------------------------
   4. PETITS SMARTPHONES & ÉCRANS ÉTROITS (max-width: 540px)
   -------------------------------------------------------------------------- */
@media (max-width: 540px) {
  /* Conteneur fluide avec padding réduit */
  .container {
    padding: 0 1rem !important;
  }

  /* Entrées 4 publics : 1 colonne */
  .entrances-grid {
    grid-template-columns: 1fr !important;
  }
  .entrance-card {
    padding: 1.5rem 1.25rem !important;
  }

  /* Domaines d'expertise : 1 colonne */
  .domains-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .domain-card {
    padding: 1.35rem 1.15rem !important;
  }

  /* Filtres Accueil : 1 colonne complète */
  .catalog-filters-row {
    grid-template-columns: 1fr !important;
  }
  .filter-item:last-child {
    grid-column: span 1 !important;
  }

  /* Footer 1 colonne */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.75rem !important;
  }
  .footer-legal-links {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  /* Time slots dans le RDV : 2 colonnes pour petits écrans */
  .time-slots-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Boutons de modalité RDV */
  .appt-type-tabs {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  .appt-tab {
    width: 100% !important;
  }

  /* Modal Footer */
  .smart-modal-footer {
    flex-direction: column !important;
  }
  .smart-modal-footer > div {
    width: 100% !important;
    margin-left: 0 !important;
  }
  .smart-modal-footer .btn {
    width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   5. SMARTPHONES ULTRA-COMPACTS (max-width: 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .hero-title {
    font-size: 1.75rem !important;
  }
  .hero-slogan {
    font-size: 0.95rem !important;
  }
  .section-title {
    font-size: 1.5rem !important;
  }
  .logo-img {
    height: 28px !important;
  }
  .catalog-search-input {
    font-size: 0.85rem !important;
  }
}

/* --------------------------------------------------------------------------
   6. ÉCRANS TRÈS LARGES & ULTRA-WIDE (min-width: 1600px)
   -------------------------------------------------------------------------- */
@media (min-width: 1600px) {
  .container {
    max-width: 1400px;
  }
  .hero-section {
    padding: 9rem 0 6rem 0;
  }
  .hero-title {
    font-size: 4rem;
  }
}
