/* ============================================
   📱 BOOSTINGHOST - STYLES MOBILE NATIFS
   ============================================ */

/* Variables CSS */
:root {
  --primary: #5BC6A3;
  --primary-dark: #4AB392;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F3F4F6;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --border-color: #E5E7EB;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Variables */
body.dark-mode {
  --primary: #5BC6A3;
  --primary-dark: #4AB392;
  --bg-primary: #1F2937;
  --bg-secondary: #374151;
  --text-primary: #F9FAFB;
  --text-secondary: #D1D5DB;
  --border-color: #4B5563;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* ============================================
   CONFIGURATION DE BASE
   ============================================ */

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
  
  /* Safe Area pour encoche iPhone */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ============================================
   NAVIGATION À ONGLETS (BOTTOM TABS)
   ============================================ */

.mobile-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  transition: background 0.3s;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 8px 4px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s, transform 0.1s;
  font-weight: 500;
}

.tab-btn i {
  font-size: 22px;
  transition: transform 0.2s;
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active i {
  transform: scale(1.1);
}

.tab-btn:active {
  transform: scale(0.95);
}

.tab-btn .badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(14px);
  background: var(--error);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
  0% { transform: translateX(14px) scale(0); }
  50% { transform: translateX(14px) scale(1.2); }
  100% { transform: translateX(14px) scale(1); }
}

/* ============================================
   PULL-TO-REFRESH
   ============================================ */

.pull-refresh-indicator {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(0) rotate(0deg);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.pull-refresh-indicator i {
  font-size: 20px;
}

.pull-refresh-indicator.ready {
  background: var(--success);
}

.pull-refresh-indicator.refreshing {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

/* ============================================
   SWIPE GESTURES
   ============================================ */

.swipeable-item {
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

.swipeable-item .swipe-content {
  position: relative;
  background: var(--bg-primary);
  z-index: 2;
  transition: transform 0.3s ease-out;
}

.swipeable-item .swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 16px;
  gap: 8px;
  z-index: 1;
}

.swipeable-item .swipe-actions button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--error);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.swipeable-item .swipe-actions button:active {
  transform: scale(0.9);
}

/* ============================================
   CARDS & CONTENT
   ============================================ */

.card {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 20px;
  margin: 12px 16px;
  box-shadow: var(--shadow);
  /* Transition supprimée - faisait bouger toutes les cartes */
  border: 1px solid var(--border-color);
}

/* Effet :active supprimé - ne devrait s'appliquer qu'aux éléments cliquables */

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-body {
  color: var(--text-primary);
}

/* ============================================
   BOTTOM SHEET
   ============================================ */

.bottom-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  pointer-events: none;
  transition: all 0.3s ease-out;
}

.bottom-sheet.open {
  pointer-events: all;
}

.bottom-sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s;
}

.bottom-sheet.open .bottom-sheet-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s ease-out, background 0.3s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-sheet.open .bottom-sheet-content {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sheet-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.sheet-close {
  background: var(--bg-secondary);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.sheet-close:active {
  transform: scale(0.9);
}

.sheet-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================
   ANIMATIONS DE PAGE
   ============================================ */

.page {
  display: none;
  min-height: 100vh;
}

.page.active {
  display: block;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ============================================
   BOUTONS
   ============================================ */

.btn {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
}

/* ============================================
   INPUTS
   ============================================ */

input,
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  transition: border 0.2s, background 0.3s, color 0.3s;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   LISTES
   ============================================ */

.list-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
  cursor: pointer;
}

.list-item:active {
  background: var(--bg-secondary);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-action {
  margin-left: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ============================================
   TOASTS / SNACKBARS
   ============================================ */

.toast {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  animation: toastSlideIn 0.3s ease-out;
  border: 1px solid var(--border-color);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

@keyframes toastSlideIn {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   LOADING
   ============================================ */

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 40px auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
  .mobile-tabs {
    display: none;
  }
  
  main,
  .container {
    padding-bottom: 20px !important;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

/* ============================================
   CORRECTIONS POUR MOBILE
   ============================================ */

/* Forcer le contenu à être centré et bien visible sur mobile */
@media (max-width: 768px) {
  .main-content {
    padding-left: 16px !important;
    padding-right: 16px !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .page-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .card, .section {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
  }
  
  /* Empêcher le débordement horizontal */
  table {
    width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
  }
  
  /* Adapter les formulaires */
  .form-row {
    flex-direction: column !important;
  }
  
  .form-row > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Assurer que tout le contenu est visible */
  * {
    box-sizing: border-box !important;
  }
  
  /* Container principal */
  .app-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: hidden !important;
  }
}

/* ============================================
   FIX SPÉCIFIQUE POUR LES TABLEAUX LARGES
   ============================================ */

@media (max-width: 768px) {
  /* Wrapper scrollable pour les tableaux */
  .table-responsive,
  .card-body:has(table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px !important;
    padding: 0 16px !important;
  }
  
  /* Tableaux fixes pour permettre le scroll horizontal */
  table {
    min-width: 800px !important;
    width: auto !important;
    display: table !important;
  }
  
  /* Assurer que les cellules ne se compressent pas */
  table th,
  table td {
    white-space: nowrap !important;
    min-width: 100px !important;
  }
  
  /* Indicateur visuel de scroll */
  .card-body:has(table)::after {
    content: '← Glissez pour voir plus →';
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 8px;
    margin-top: 8px;
  }
}
/* 🚫 Cacher le menu hamburger sur mobile */
@media (max-width: 768px) {
  .mobile-menu-btn,
  #mobileMenuBtn {
    display: none !important;
  }
  
  /* Centrer le logo */
  .mobile-header {
    justify-content: center !important;
  }
}
