/* ============================================================
   MOUNCONSULTING — RESPONSIVE MOBILE & TABLETTE
   v1.8.0 — breakpoints: 480px (mobile), 768px (tablette), 900px (large tablet)
   ============================================================ */

/* ── VIEWPORT META already in header.php ── */

/* ══════════════════════════════════════════════════════
   1. SITE PUBLIC — PAGES MARKETING
══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Container */
  .mc-container {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Hero */
  .mc-hero { padding: 40px 0 32px; }
  .mc-hero-inner { grid-template-columns: 1fr !important; gap: 24px; }
  .mc-hero-svg { display: none !important; }
  .mc-hero h1 { font-size: 30px; letter-spacing: -0.8px; }
  .mc-hero .hero-sub { font-size: 15px; }

  /* Titles */
  .mc-title { font-size: 26px; letter-spacing: -0.5px; }
  .mc-title-lg { font-size: 28px; letter-spacing: -0.8px; }

  /* Sections */
  .mc-section { padding: 56px 0; }
  .mc-section-sm { padding: 36px 0; }

  /* Nav */
  .mc-nav-links { display: none !important; flex-direction: column !important; position: fixed !important; top: 100px !important; left: 0 !important; right: 0 !important; background: #fff !important; border-bottom: 1px solid #e2e8f0 !important; padding: 16px 20px !important; gap: 8px !important; z-index: 999 !important; max-height: calc(100vh - 118px); overflow-y: auto; }
  .mc-nav-links.open { display: flex !important; }
  .mc-nav-toggle { display: flex !important; }
  .mc-nav-links li { width: 100%; }
  .mc-nav-links a { display: block; width: 100%; padding: 12px 0; font-size: 15px; border-bottom: 1px solid #f1f5f9; }
  .mc-nav-links .nav-cta { display: block; text-align: center; margin-top: 8px; }
  .mc-nav-auth { width: 100%; margin-top: 4px; }
  .mc-btn-connexion { width: 100% !important; justify-content: center !important; border-radius: 10px !important; }
  .mc-user-btn { width: 100% !important; justify-content: center !important; border-radius: 10px !important; }
  .mc-user-dropdown { position: static !important; box-shadow: none !important; margin-top: 6px; border-radius: 10px; }

  /* Grids */
  .mc-cards-grid { grid-template-columns: 1fr !important; gap: 14px; }
  .mc-stats-inner { grid-template-columns: repeat(2, 1fr) !important; gap: 16px; }
  .mc-two-col { grid-template-columns: 1fr !important; direction: ltr !important; gap: 32px; }
  .mc-two-col.reverse { direction: ltr !important; }
  .mc-sector-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .mc-choose-grid { grid-template-columns: 1fr !important; gap: 14px; }
  .mc-format-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .mc-contact-grid { grid-template-columns: 1fr !important; gap: 32px; }
  .mc-footer-top { grid-template-columns: 1fr 1fr !important; gap: 24px; }

  /* Pricing */
  .mc-pricing { padding: 32px 24px; }
  .mc-price { font-size: 44px; }
  .mc-price-features { grid-template-columns: 1fr !important; gap: 8px; }

  /* Modal */
  .mc-modal { padding: 28px 20px; border-radius: 16px; }

  /* Forms */
  .mc-form-row { grid-template-columns: 1fr !important; }

  /* Panel entreprise */
  .mc-panel.active { grid-template-columns: 1fr !important; }

  /* Btn actions */
  .btn-actions { flex-direction: column; gap: 12px; }
  .btn-primary, .btn-secondary, .btn-ghost, .btn-white { width: 100%; justify-content: center; }

  /* Stats bar */
  .mc-stats { padding: 28px 0; }

  /* CTA Banner */
  .mc-cta-banner { padding: 56px 0; }
  .mc-cta-banner h2 { font-size: 28px; }

  /* Footer */
  .mc-footer-bottom { flex-direction: column !important; gap: 12px !important; text-align: center !important; }

  /* Tabs */
  .mc-tab-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mc-tab-btn { font-size: 13px; padding: 10px 16px; white-space: nowrap; }

  /* Week timeline */
  .mc-week { grid-template-columns: 1fr !important; gap: 8px; }
  .mc-week::after { display: none !important; }
  .mc-week-num { margin-left: 0 !important; }

  /* Logo nav */
  .mc-logo-img { width: 80px !important; height: 80px !important; }
  #mc-nav { height: 88px !important; }
  .mc-nav-inner { height: 88px !important; }
  #mc-nav .mc-logo { max-height: 88px !important; }
}

@media (max-width: 480px) {
  .mc-container { padding-left: 16px; padding-right: 16px; }
  .mc-hero h1 { font-size: 26px; }
  .mc-title { font-size: 22px; }
  .mc-title-lg { font-size: 24px; }
  .mc-stats-inner { grid-template-columns: 1fr 1fr !important; }
  .mc-sector-grid { grid-template-columns: 1fr !important; }
  .mc-stat-num { font-size: 28px !important; }
  .mc-footer-top { grid-template-columns: 1fr !important; }
  .mc-pricing { padding: 24px 16px; }
  .mc-modal { padding: 20px 16px; margin: 8px; width: calc(100% - 16px); }
  .mc-choose-btn { padding: 24px 20px; }
  .mc-format-card { padding: 24px 20px; }

  /* Steps bar modal */
  .mc-step-label { display: none; }
  .mc-step-circle { width: 30px; height: 30px; font-size: 12px; }
  .mc-steps-bar { padding-bottom: 1rem; margin-bottom: 1.2rem; }
}


/* ══════════════════════════════════════════════════════
   2. ESPACE FORMATEUR & ÉTUDIANT (LMS)
══════════════════════════════════════════════════════ */

/* ── 2a. SIDEBAR & LAYOUT PRINCIPAL ── */
@media (max-width: 900px) {
  /* Sidebar slide-in déjà géré — on renforce */
  .ms-sidebar {
    transform: translateX(-248px) !important;
    transition: transform .25s cubic-bezier(.4,0,.2,1) !important;
    z-index: 300 !important;
  }
  .ms-sidebar.open { transform: translateX(0) !important; }
  .ms-main { margin-left: 0 !important; }
  .ms-topbar { left: 0 !important; padding: 0 16px !important; }
  .ms-hamburger { display: flex !important; }
  .ms-content { padding: 16px 14px !important; }

  /* Grilles LMS */
  .ms-grid-2, .ms-grid-3, .ms-grid-4 { grid-template-columns: 1fr !important; }
  .ms-dash-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* Messagerie */
  .ms-msg-sidebar { width: 240px; }

  /* Profil */
  .ms-profil-fields { grid-template-columns: 1fr !important; }
}

/* ── 2b. MOBILE STRICT ── */
@media (max-width: 600px) {
  /* Content padding réduit */
  .ms-content { padding: 12px 12px !important; }
  .ms-topbar { height: 52px !important; padding: 0 12px !important; }

  /* KPI dash — 2 colonnes */
  .ms-dash-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Messagerie — layout colonne */
  .ms-msg-layout { flex-direction: column !important; height: auto !important; min-height: calc(100vh - 52px); }
  .ms-msg-sidebar { width: 100% !important; height: auto !important; max-height: 200px !important; border-right: none !important; border-bottom: 1px solid var(--border); }
  .ms-msg-main { min-height: 400px; }
  .ms-bubble-wrap { max-width: 88% !important; }

  /* Fichiers */
  .ms-file-row { grid-template-columns: 32px 1fr auto !important; }
  .ms-file-row .ms-btn:not(.ms-file-dl-link) { display: none !important; }
  .ms-file-row .ms-file-dl-link { display: inline-flex !important; }

  /* Planning — toolbar */
  .plg-toolbar { gap: 6px !important; }
  .plg-period-label { min-width: 120px !important; font-size: 12px !important; }
  .plg-view-btn { padding: 5px 10px !important; font-size: 11.5px !important; }
  .plg-legend { padding: 8px 16px !important; gap: 10px !important; }

  /* Planning — calendrier mois : cellules compactes */
  .plg-month-cell { min-height: 60px !important; padding: 4px 4px !important; }
  .plg-month-evt { font-size: 9px !important; padding: 1px 4px !important; }
  .plg-month-slot { font-size: 9px !important; padding: 1px 4px !important; }
  .plg-day-num { width: 22px !important; height: 22px !important; font-size: 11px !important; }
  .plg-month-dow { font-size: 9px !important; padding: 6px 2px !important; letter-spacing: 0 !important; }

  /* Planning — vue semaine : réduite */
  .plg-week-date-num { font-size: 16px !important; }
  .plg-week-dow { font-size: 9px !important; }
  .plg-time-row { height: 50px !important; }
  .plg-hour-cell { height: 50px !important; }
  .plg-time-lbl { font-size: 9px !important; }

  /* Accordion étudiants */
  .e2-jours { display: none !important; }
  .e2-head { padding: 12px 14px !important; gap: 10px !important; }
  .e2-docs-layout { grid-template-columns: 1fr !important; gap: 14px !important; }

  /* Student stat block */
  .ms-stat-block { padding: 12px 14px !important; }

  /* Modals LMS */
  .ms-modal-box {
    width: 95% !important;
    padding: 20px 16px !important;
    border-radius: 14px !important;
    max-height: 92vh;
    overflow-y: auto;
  }
  .ms-modal-btns { flex-direction: column !important; gap: 8px !important; }
  .ms-modal-btns .ms-btn { width: 100% !important; justify-content: center !important; }

  /* Cards LMS */
  .ms-card { padding: 14px 16px !important; }

  /* Topbar titre */
  .ms-topbar-title { font-size: 15px !important; }
  .ms-topbar-sub { display: none; }

  /* Notif panel */
  .mc-notif-panel { width: 300px !important; right: -60px !important; }

  /* Tabs étudiants */
  .e2-tab { padding: 10px 14px !important; font-size: 11.5px !important; }
  .e2-tabs { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; flex-wrap: nowrap !important; }

  /* Planning grid lateral */
  .lms-planning-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 400px) {
  /* Très petits écrans */
  .ms-dash-grid { grid-template-columns: 1fr !important; }
  .ms-msg-conv-item { padding: 10px 12px !important; }
  .plg-month-cell { min-height: 48px !important; }
  .mc-notif-panel { width: 280px !important; right: -80px !important; }
  .ms-sidebar { width: 220px !important; }
  .plg-nav-btn { width: 28px !important; height: 28px !important; }
}


/* ══════════════════════════════════════════════════════
   3. ÉLÉMENTS COMMUNS TOUCH-FRIENDLY
══════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  /* Zone de clic min 44px pour tactile */
  .ms-nav-item,
  .ms-btn,
  .btn-primary,
  .btn-secondary,
  .e2-tab,
  .plg-nav-btn,
  .plg-view-btn,
  .plg-today-btn,
  .ms-cal-nav-btn,
  .mc-faq-q,
  .mc-tab-btn {
    min-height: 44px;
  }

  /* Inputs plus grands */
  .ms-input, .ms-select, .ms-textarea,
  .mc-field input, .mc-field select, .mc-field textarea {
    font-size: 16px !important; /* évite le zoom iOS */
    min-height: 44px;
  }

  /* Scroll horizontal pour tableaux */
  .ms-table-wrap,
  table.ms-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
  }

  /* Boutons LMS stacked */
  .ms-topbar-actions { gap: 6px !important; }

  /* Panel latéral de détail planning */
  .lms-planning-grid { grid-template-columns: 1fr !important; }
}


/* ══════════════════════════════════════════════════════
   4. PAGE CONNEXION
══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .mc-connexion-grid,
  .ms-login-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .mc-connexion-svg { display: none !important; }
  .ms-login-box { padding: 28px 20px !important; }
}


/* ══════════════════════════════════════════════════════
   5. CORRECTIONS OVERFLOW GLOBAL
══════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  /* Empêche tout débordement horizontal */
  body { overflow-x: hidden !important; }
  .mc-terminal { overflow-x: auto; }
  .mc-terminal-body { font-size: 11px !important; }
  .mc-week-items { gap: 6px; }
  .mc-tag { font-size: 12px; padding: 5px 10px; }
}


/* ══════════════════════════════════════════════════════
   6. PRINT — masquer les sidebars
══════════════════════════════════════════════════════ */

@media print {
  .ms-sidebar, #mc-nav, .ms-topbar, .ms-hamburger { display: none !important; }
  .ms-main { margin-left: 0 !important; }
  .ms-content { padding: 0 !important; }
}


/* ══════════════════════════════════════════════════════
   7. OFFSET NAV FIXE — compense la hauteur du header sticky
   Nav desktop = 118px, tablette = 88px (depuis responsive.css)
══════════════════════════════════════════════════════ */

/* Sur toutes les pages publiques, la première section doit compenser le nav fixe */
#mc-nav ~ * > section:first-of-type,
#mc-nav + section,
body:not(.page-template-page-espace-formateur):not(.page-template-page-espace-etudiant) > main > section:first-child,
.site-content > section:first-child {
  scroll-margin-top: 100px;
}

/* Offset global pour le body sur les pages publiques */
body:not(.page-template-page-espace-formateur):not(.page-template-page-espace-etudiant) {
  padding-top: 100px;
}

/* Pages espaces membres : pas de nav thème → pas d'offset */
body.page-template-page-espace-formateur,
body.page-template-page-espace-etudiant {
  padding-top: 0 !important;
}

@media (max-width: 768px) {
  body:not(.page-template-page-espace-formateur):not(.page-template-page-espace-etudiant) {
    padding-top: 80px;
  }
}

@media (max-width: 480px) {
  body:not(.page-template-page-espace-formateur):not(.page-template-page-espace-etudiant) {
    padding-top: 80px;
  }
}


/* ══════════════════════════════════════════════════════
   8. TITRES — tailles adaptées mobile
══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* H1 des pages (font-size:44px inline) */
  h1.mc-title,
  .mc-title[style*="font-size:44px"],
  .mc-title[style*="font-size: 44px"] {
    font-size: 26px !important;
    line-height: 1.2 !important;
    letter-spacing: -0.5px !important;
  }
  /* H2 */
  h2.mc-title,
  .mc-title[style*="font-size:28px"],
  .mc-title[style*="font-size:32px"] {
    font-size: 22px !important;
  }
  /* mc-title-lg */
  .mc-title-lg {
    font-size: 26px !important;
    letter-spacing: -0.5px !important;
  }
  /* Hero h1 principal */
  .mc-hero h1 {
    font-size: 28px !important;
    letter-spacing: -0.5px !important;
  }
  /* Subtitle */
  .mc-subtitle {
    font-size: 14px !important;
  }
  /* Sections hero padding */
  section[style*="padding:72px"] {
    padding-top: 36px !important;
    padding-bottom: 28px !important;
  }
}

@media (max-width: 480px) {
  h1.mc-title,
  .mc-title[style*="font-size:44px"],
  .mc-title[style*="font-size: 44px"] {
    font-size: 22px !important;
  }
  .mc-hero h1 { font-size: 24px !important; }
  .mc-title-lg { font-size: 22px !important; }
}


/* ══════════════════════════════════════════════════════
   9. FORMULAIRES ENTREPRISES — panels recrutement/formation
══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Panel recrutement / formation : forcer 1 colonne */
  .mc-panel.active {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .mc-panel-info {
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .mc-panel-info,
  .mc-panel-form {
    padding: 24px 20px !important;
  }
  /* Choose grid — déjà géré mais on renforce */
  .mc-choose-grid {
    grid-template-columns: 1fr !important;
  }
  .mc-choose-btn {
    padding: 24px 20px !important;
  }
}


/* ══════════════════════════════════════════════════════
   10. PAGE FORMATION — grille chiffres
══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .mc-stats-chiffres {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}


/* ══════════════════════════════════════════════════════
   11. PAGE ENTREPRISES — grille 3 choix responsive
══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .mc-choose-grid[style*="repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 768px) {
  .mc-choose-grid[style*="repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}
