/* =====================================================
   YAKOCARE - Sidebar responsive mobile v3 (2026-08-22 fix)
   CACHE-BUST VERSION — fixes: hidden sidebar, no margin, hamburger visible
   ===================================================== */

/* === MOBILE: sidebar COMPLETELY hidden by default === */
@media (max-width: 1024px) {
  /* Hide sidebar with every possible selector */
  #master-sidebar,
  .sidebar,
  aside[id*="sidebar"],
  [id="master-sidebar"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 270px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1050 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    visibility: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* When opened via JS toggle */
  #master-sidebar.sidebar-open,
  .sidebar.sidebar-open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.55) !important;
  }

  /* === Overlay behind sidebar === */
  .mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    cursor: pointer;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .mobile-sidebar-overlay.active {
    display: block;
  }

  /* === Hamburger button === */
  #mobile-sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    top: 14px !important;
    left: 14px !important;
    z-index: 1100 !important;
    width: 44px !important;
    height: 44px !important;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
    transition: background 0.2s !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  #mobile-sidebar-toggle:hover,
  #mobile-sidebar-toggle:active {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  }

  /* === CONTENT: full width, zero margin === */
  /* Tailwind class wrapper */
  .lg\:ml-\[270px\] {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Named content containers */
  main,
  .main-content,
  #main,
  #main-content,
  .content,
  .page-content,
  [class*="main-content"],
  [class*="content-wrapper"] {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Inline style overrides (attribute selector) */
  [style*="margin-left: 270px"],
  [style*="margin-left:270px"],
  [style*="margin-left: 270"],
  [style*="marginLeft"] {
    margin-left: 0 !important;
  }

  /* Padding-top for header space */
  .lg\:ml-\[270px\],
  main.main-content,
  main[style*="margin-left"] {
    padding-top: 60px !important;
  }

  /* Header: leave room for hamburger */
  header,
  .sticky.top-0,
  [class*="sticky"][class*="top-0"] {
    padding-left: 64px !important;
  }

  /* === RESPONSIVE GRIDS === */
  .grid-cols-4,
  .xl\:grid-cols-4,
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .sm\:flex-row { flex-direction: column !important; }
  .sm\:items-center { align-items: flex-start !important; }
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .sm\:w-auto { width: 100% !important; }
  main.p-4, main.p-6, main.p-8 {
    padding: 16px !important;
    padding-top: 60px !important;
  }
}

@media (max-width: 480px) {
  .grid-cols-4, .xl\:grid-cols-4,
  .sm\:grid-cols-2, .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
  h1 { font-size: 1.25rem !important; }
  h2 { font-size: 1.1rem !important; }
  .sm\:w-auto button, .flex.gap-2 button {
    width: 100% !important;
    justify-content: center;
  }
}

/* === DESKTOP: hide hamburger + overlay === */
@media (min-width: 1025px) {
  #mobile-sidebar-toggle { display: none !important; }
  .mobile-sidebar-overlay { display: none !important; }
}

/* === iOS zoom fix: 16px font on inputs === */
@media (max-width: 1024px) {
  input, select, textarea {
    font-size: 16px !important;
    padding: 12px 14px !important;
    min-height: 44px;
  }
  button, .btn, a.btn, .nav-link, .sidebar-nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 768px) {
  /* Force texte blanc visible sur bouton Consulter — 2026-08-22 */
  a[href*="consultation.html"],
  a[class*="2563eb"],
  button[onclick*="startConsultation"],
  .btn-consulter {
    color: #ffffff !important;
    overflow: visible !important;
  }
  a[href*="consultation.html"] *,
  a[class*="2563eb"] * {
    color: #ffffff !important;
    opacity: 1 !important;
  }
}
