/**
 * WIFIZONE - Styles Personnalisés
 * Palette de couleurs et design system basé sur style_font.md
 * Compatible avec Tailwind CDN
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   PALETTE DE COULEURS WIFIZONE
   ============================================ */

:root {
  /* Couleurs Principales WIFIZONE */
  --color-primary: #6741E6;        /* Accent Violet principal */
  --color-primary-50: #F3F1FF;
  --color-primary-100: #EAE6FF;
  
  /* Couleurs Neutres */
  --color-page: #F2F3F6;          /* Page / surface light */
  --color-soft: #F2F2F2;           /* Soft off-white */
  --color-panel: #58585E;          /* Main dark grey (panels / subtle) */
  --color-muted: #8B8B8B;          /* Muted grey (caption / subtle text) */
  --color-dark: #18181A;           /* Dark panel / title text */
  
  /* Couleurs d'État */
  --color-success: #10B981;       /* Vert - Succès */
  --color-danger: #EF4444;         /* Rouge - Erreur */
  --color-warning: #F59E0B;       /* Orange - Avertissement */
  --color-info: #06B6D4;           /* Cyan - Information */
  
  /* Ombres */
  --shadow-soft: 0 6px 18px rgba(21, 23, 27, 0.06);
  --shadow-inset-soft: inset 0 -1px 0 rgba(0,0,0,0.04);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
}

/* ============================================
   TYPOGRAPHIE - INTER
   ============================================ */

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-page);
  color: var(--color-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   COMPOSANTS - BOUTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: #5B21B6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(103, 61, 230, 0.3);
}

.btn-secondary {
  background-color: #F3F4F6;
  color: var(--color-dark);
  border: 1px solid #E5E7EB;
}

.btn-secondary:hover {
  background-color: #E5E7EB;
}

/* ============================================
   COMPOSANTS - INPUTS
   ============================================ */

.input {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid #D1D5DB;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  font-size: 0.875rem;
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.1);
}

/* ============================================
   COMPOSANTS - CARTES KPI
   ============================================ */

.kpi-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease-in-out;
}

.kpi-card:hover {
  box-shadow: 0 8px 24px rgba(21, 23, 27, 0.1);
  transform: translateY(-2px);
}

/* ============================================
   COMPOSANTS - AVATAR
   ============================================ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  color: white;
}

/* ============================================
   COMPOSANTS - BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.badge-info {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--color-info);
}

/* ============================================
   COMPOSANTS - SIDEBAR
   ============================================ */

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: #6B7280;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  font-size: 0.875rem;
}

.sidebar-item:hover {
  background-color: #F3F4F6;
  color: #111827;
}

.sidebar-item.active {
  background-color: #F3F4F6;
  color: #111827;
  font-weight: 600;
}

.sidebar-item svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

/* ============================================
   COMPOSANTS - SIDEBAR CATEGORIES
   ============================================ */

.sidebar-category {
  margin-bottom: 0.5rem;
}

.sidebar-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
  border-radius: 0.5rem;
}

.sidebar-category-header:hover {
  color: var(--color-primary);
  background-color: rgba(103, 61, 230, 0.05);
}

.sidebar-category-header svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.sidebar-category-header[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.sidebar-category-items {
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.sidebar-category-items.collapsed {
  max-height: 0;
}

.sidebar-subcategory {
  margin-left: 0.5rem;
  margin-top: 0.25rem;
}

.sidebar-subcategory-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-subcategory-items {
  padding-left: 0.5rem;
}

/* ============================================
   COMPOSANTS - MODALES
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  background: linear-gradient(135deg, var(--color-info) 0%, var(--color-primary) 100%);
  color: white;
  border-radius: 1rem 1rem 0 0;
}

/* ============================================
   COMPOSANTS - ALERTS
   ============================================ */

.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--color-info);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Animation "respiration" pour le bouton Devenir Partenaire */
@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(103, 61, 230, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(103, 61, 230, 0.5);
  }
}

.btn-breathe {
  animation: breathe 2s ease-in-out infinite;
}

.btn-breathe:hover {
  animation: none;
  transform: scale(1.05);
}

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

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #D1D5DB;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   UTILITAIRES
   ============================================ */

.text-balance {
  text-wrap: balance;
}

/* Alpine.js x-cloak - Masquer le contenu jusqu'à l'initialisation */
[x-cloak] {
  display: none !important;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background-color: #F3F4F6;
}

::-webkit-scrollbar-thumb {
  background-color: #D1D5DB;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #9CA3AF;
}

/* Classes utilitaires pour les couleurs neutres */
.bg-neutral-page { background-color: var(--color-page); }
.bg-neutral-soft { background-color: var(--color-soft); }
.text-neutral-dark { color: var(--color-dark); }
.text-neutral-muted { color: var(--color-muted); }
.text-neutral-panel { color: var(--color-panel); }

/* Ombres personnalisées */
.shadow-soft {
  box-shadow: var(--shadow-soft);
}

/* Transitions */
.transition-all {
  transition: all var(--transition-base);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
  /* Sidebar mobile */
  .sidebar-mobile {
    position: fixed;
    inset: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }
  
  .sidebar-mobile.open {
    transform: translateX(0);
  }
  
  /* Tableaux responsives */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
  }
  
  /* Modales mobile */
  .modal-content {
    max-width: 95vw;
    margin: 1rem;
  }
  
  /* KPIs grid mobile */
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  /* Padding réduit mobile */
  .container-mobile {
    padding: 1rem;
  }
  
  /* Filtres mobile */
  .filters-mobile {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  /* Header mobile */
  .header-mobile {
    padding: 0.75rem 1rem;
  }
  
  /* Text mobile */
  .text-mobile-sm {
    font-size: 0.75rem;
  }
  
  /* Buttons mobile */
  .btn-mobile {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}

/* Tablettes */
@media (min-width: 769px) and (max-width: 1023px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
