/* ============================================================
   MONCOACH MOBILE FIX v8 - COMPLETE SOLUTION
   Fixes: sidebar position, colors, responsive, transitions
   ============================================================ */

/* ===========================================
   1. SIDEBAR COLORS - ALL WHITE ON DARK
   =========================================== */

/* Force ALL sidebar text to white/light */
.sidebar,
.sidebar *,
.sidebar-wrapper .sidebar,
.sidebar-wrapper .sidebar * {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Logo */
.sidebar .logo-text {
  color: white !important;
  -webkit-text-fill-color: white !important;
  font-weight: 700 !important;
  font-size: 20px !important;
}

.sidebar .logo-badge {
  color: rgba(255, 255, 255, 0.7) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  border-radius: 20px !important;
}

/* Nav items */
.sidebar .nav-item {
  color: rgba(255, 255, 255, 0.85) !important;
  background: transparent !important;
  padding: 12px 14px !important;
  border-radius: 10px !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  transition: all 0.15s ease !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: white !important;
}

.sidebar .nav-item.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
}

.sidebar .nav-item svg {
  color: currentColor !important;
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
}

/* Pro badges */
.sidebar .nav-pro-badge {
  background: linear-gradient(135deg, #F59E0B, #F97316) !important;
  color: white !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  margin-left: auto !important;
}

/* ===========================================
   2. FOOTER BUTTONS - CONNEXION FIX
   =========================================== */

/* S'inscrire button - primary */
.sidebar .login-cta,
.sidebar-footer .login-cta,
.auth-buttons .login-cta {
  background: linear-gradient(135deg, #3B82F6, #2563EB) !important;
  color: white !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 14px 20px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  min-height: 48px !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.sidebar .login-cta:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
  transform: translateY(-1px) !important;
}

/* CONNEXION BUTTON - FIX BLACK ON BLACK */
.sidebar .login-secondary,
.sidebar-footer .login-secondary,
.auth-buttons .login-secondary,
button.login-secondary {
  background: rgba(255, 255, 255, 0.1) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 12px !important;
  padding: 12px 20px !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  min-height: 44px !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  margin-top: 8px !important;
}

.sidebar .login-secondary:hover,
.sidebar-footer .login-secondary:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Auth buttons container */
.sidebar .auth-buttons,
.sidebar-footer .auth-buttons {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
}

/* ===========================================
   3. USER CARD (logged in state)
   =========================================== */

.sidebar .user-card,
.sidebar-footer .user-card {
  background: rgba(255, 255, 255, 0.05) !important;
  border-radius: 12px !important;
  padding: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.sidebar .user-avatar {
  background: linear-gradient(135deg, #3B82F6, #6366F1) !important;
  color: white !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
}

.sidebar .user-name {
  color: white !important;
  font-weight: 600 !important;
  font-size: 14px !important;
}

.sidebar .user-email {
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 12px !important;
}

.sidebar .user-badge {
  background: #3B82F6 !important;
  color: white !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
}

.sidebar .user-badge.trial {
  background: #F59E0B !important;
}

.sidebar .logout-btn {
  color: rgba(255, 255, 255, 0.6) !important;
  background: transparent !important;
  border: none !important;
  padding: 8px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

.sidebar .logout-btn:hover {
  color: #EF4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* ===========================================
   4. UPGRADE BANNER
   =========================================== */

.sidebar .upgrade-banner {
  padding: 0 !important;
  margin: 8px 0 !important;
}

.sidebar .upgrade-sidebar-btn {
  background: linear-gradient(135deg, #F59E0B, #F97316) !important;
  color: white !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  width: 100% !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
}

.sidebar .upgrade-sidebar-btn:hover {
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4) !important;
}

/* ===========================================
   5. SIDEBAR LAYOUT - FLEX SECTIONS
   =========================================== */

.sidebar,
aside.sidebar {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%) !important;
  overflow: hidden !important;
}

.sidebar .sidebar-header,
.sidebar-header {
  flex: 0 0 auto !important;
  height: auto !important;
  max-height: 100px !important;
  padding: 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-bottom: 0 !important;
}

.sidebar .sidebar-nav,
.sidebar-nav {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0 !important;
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.sidebar .sidebar-footer,
.sidebar-footer {
  flex: 0 0 auto !important;
  height: auto !important;
  max-height: 180px !important;
  padding: 16px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-top: auto !important;
}

/* Scrollbar */
.sidebar-nav::-webkit-scrollbar {
  width: 4px !important;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent !important;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 4px !important;
}

/* ===========================================
   6. MOBILE POSITION & ANIMATION
   =========================================== */

@media screen and (max-width: 768px) {
  /* Sidebar wrapper - off-screen by default */
  .sidebar-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 10000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform !important;
    background: transparent !important;
  }
  
  /* Sidebar open - slide in */
  .sidebar-wrapper.open {
    transform: translateX(0%) !important;
  }
  
  /* Sidebar content - NO additional transform */
  .sidebar-wrapper .sidebar,
  .sidebar-wrapper aside.sidebar,
  aside.sidebar,
  .sidebar {
    transform: none !important;
    -webkit-transform: none !important;
    position: relative !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Overlay - semi-transparent */
  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 9999 !important;
  }
  
  /* Main content */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-top: 56px !important;
  }
  
  /* Mobile header */
  .mobile-header {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 56px !important;
    background: white !important;
    border-bottom: 1px solid #E2E8F0 !important;
    z-index: 999 !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
  }
  
  .menu-toggle {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #F1F5F9 !important;
    border-radius: 10px !important;
    border: none !important;
    color: #1E293B !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  
  .menu-toggle:active {
    background: #E2E8F0 !important;
    transform: scale(0.95) !important;
  }
}

/* ===========================================
   7. DESKTOP - SIDEBAR ALWAYS VISIBLE
   =========================================== */

@media screen and (min-width: 769px) {
  .sidebar-wrapper {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 260px !important;
    height: 100vh !important;
    transform: none !important;
    z-index: 1000 !important;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
  
  .main-content {
    margin-left: 260px !important;
    padding-top: 0 !important;
  }
  
  .mobile-header {
    display: none !important;
  }
}

/* ===========================================
   8. ICONS & SVGs
   =========================================== */

.sidebar svg,
.sidebar-wrapper svg {
  color: currentColor !important;
}

/* Close button X */
.sidebar-wrapper .sidebar button[class*="close"],
.sidebar-wrapper button:has(svg[class*="close"]) {
  color: white !important;
  background: rgba(255, 255, 255, 0.1) !important;
}
