/* ===== THÈME UNIFIÉ CBM TELECOM ===== */

:root {
  /* Couleurs principales */
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --primary-hover: 221.2 83.2% 45%;
  
  /* Couleurs secondaires */
  --secondary: 210 40% 96%;
  --secondary-foreground: 222.2 84% 4.9%;
  --secondary-hover: 210 40% 90%;
  
  /* Couleurs d'accent */
  --accent: 210 40% 96%;
  --accent-foreground: 222.2 84% 4.9%;
  
  /* Couleurs de fond */
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  
  /* Couleurs neutres */
  --muted: 210 40% 96%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
  
  /* Couleurs de destruction */
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --destructive-hover: 0 84.2% 55%;
  
  /* Couleurs de succès */
  --success: 142.1 76.2% 36.3%;
  --success-foreground: 355.7 100% 97.3%;
  --success-hover: 142.1 76.2% 32%;
  
  /* Couleurs d'avertissement */
  --warning: 38 92% 50%;
  --warning-foreground: 48 96% 89%;
  --warning-hover: 38 92% 45%;
  
  /* Couleurs d'information */
  --info: 199 89% 48%;
  --info-foreground: 210 40% 98%;
  --info-hover: 199 89% 43%;
  
  /* Rayons et espacements */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Ombres */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode sombre */
.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 84% 4.9%;
  --primary-hover: 217.2 91.2% 55%;
  
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --secondary-hover: 217.2 32.6% 22%;
  
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 94.1%;
  
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --destructive-hover: 0 62.8% 35%;
}

/* ===== STYLES DE BASE ===== */

* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  transition: var(--transition);
}

/* ===== COMPOSANTS COMMUNS ===== */

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.5rem 1rem;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: hsl(var(--primary-hover));
  box-shadow: var(--shadow);
}

.btn-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
}

.btn-secondary:hover:not(:disabled) {
  background-color: hsl(var(--secondary-hover));
}

.btn-destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover:not(:disabled) {
  background-color: hsl(var(--destructive-hover));
}

.btn-outline {
  background-color: transparent;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

.btn-outline:hover:not(:disabled) {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-ghost {
  background-color: transparent;
  color: hsl(var(--foreground));
}

.btn-ghost:hover:not(:disabled) {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Tailles de boutons */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5rem;
}

/* Labels */
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
}

/* Champs de saisie */
.input {
  display: block;
  height: 2.5rem;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input)) !important;
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: var(--transition);
  color: hsl(var(--foreground));
  box-sizing: border-box;
}

textarea.input {
  height: auto;
  min-height: 6rem;
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input::placeholder {
  color: hsl(var(--muted-foreground));
  opacity: 0.5;
}

/* Cartes */
.card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Alertes */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: 1px solid;
}

.alert-success {
  background-color: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
  border-color: hsl(var(--success) / 0.2);
}

.alert-error {
  background-color: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.2);
}

.alert-warning {
  background-color: hsl(var(--warning) / 0.1);
  color: hsl(var(--warning));
  border-color: hsl(var(--warning) / 0.2);
}

.alert-info {
  background-color: hsl(var(--info) / 0.1);
  color: hsl(var(--info));
  border-color: hsl(var(--info) / 0.2);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

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

.text-primary { color: hsl(var(--primary)); }
.text-secondary { color: hsl(var(--secondary-foreground)); }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-destructive { color: hsl(var(--destructive)); }
.text-success { color: hsl(var(--success)); }
.text-warning { color: hsl(var(--warning)); }
.text-info { color: hsl(var(--info)); }

.bg-primary { background-color: hsl(var(--primary)); }
.bg-secondary { background-color: hsl(var(--secondary)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-destructive { background-color: hsl(var(--destructive)); }
.bg-success { background-color: hsl(var(--success)); }
.bg-warning { background-color: hsl(var(--warning)); }
.bg-info { background-color: hsl(var(--info)); }

.border-primary { border-color: hsl(var(--primary)); }
.border-secondary { border-color: hsl(var(--secondary)); }
.border-muted { border-color: hsl(var(--muted)); }
.border-destructive { border-color: hsl(var(--destructive)); }

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

@media (max-width: 640px) {
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .input {
    height: 2.25rem;
    padding: 0.375rem 0.625rem;
  }
}

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

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

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

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

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

/* ===== THÈME SPÉCIFIQUE CBM TELECOM ===== */

.brand-gradient {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
}

.brand-shadow {
  box-shadow: 0 4px 20px hsl(var(--primary) / 0.3);
}

.brand-border {
  border: 2px solid hsl(var(--primary));
}

.brand-text {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== BOUTON DE CHANGEMENT DE THÈME ===== */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  background: hsl(var(--accent));
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: hsl(var(--foreground));
  transition: var(--transition);
}

/* Animation de transition entre thèmes */
* {
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

/* Styles spécifiques pour le mode sombre */
.dark .theme-toggle {
  background: hsl(var(--card));
  border-color: hsl(var(--border));
}

.dark .theme-toggle:hover {
  background: hsl(var(--accent));
}

/* ===== OPTIMISATION DES LOGOS ===== */

.brand-logo {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: none; /* Désactive toutes les transitions */
  filter: brightness(1);
}

.dark .brand-logo img {
  filter: brightness(1.1);
}

/* Préchargement des logos pour éviter le flash */
.brand-logo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

/* ===== RÈGLES POUR LES ICÔNES DU THÈME ===== */

/* Règles pour afficher/masquer les icônes selon le thème */
.theme-icon-light {
  display: block;
}

.theme-icon-dark {
  display: none;
}

.dark .theme-icon-light {
  display: none;
}

.dark .theme-icon-dark {
  display: block;
}

/* ===== NAVIGATION ===== */

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border-radius: 0.375rem;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.nav-link.active {
  color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.1);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 2px;
  background-color: hsl(var(--primary));
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border-radius: 0.375rem;
  transition: all var(--transition);
  text-decoration: none;
}

.mobile-nav-link:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.mobile-nav-link.active {
  color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.1);
}

/* ===== AUTOCOMPLETE STYLING ===== */
/* Force autocomplete wrapper to full width */
.autoComplete_wrapper {
  width: 100% !important;
  display: block !important;
}

/* Force same styling for inputs in autocomplete wrapper */
.autoComplete_wrapper input {
  color: hsl(var(--foreground)) !important;
  opacity: 1 !important;
}

.autoComplete_wrapper input::placeholder {
  color: hsl(var(--muted-foreground)) !important;
  opacity: 0.5 !important;
}

#autoComplete_list {
  background-color: hsl(var(--card)) !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
  margin-top: 0.25rem !important;
  overflow: hidden !important;
  z-index: 9999 !important;
}

#autoComplete_list::before {
  content: none !important;
}

#autoComplete_list .autoComplete_result {
  background-color: hsl(var(--card)) !important;
  color: hsl(var(--foreground)) !important;
  padding: 0.5rem 0.75rem !important;
  transition: background-color 0.15s ease !important;
  border: none !important;
}

#autoComplete_list .autoComplete_result:hover,
#autoComplete_list .autoComplete_result[aria-selected="true"] {
  background-color: hsl(var(--accent)) !important;
  color: hsl(var(--accent-foreground)) !important;
  cursor: pointer !important;
}

#autoComplete_list .autoComplete_highlighted {
  background-color: transparent !important;
  color: hsl(var(--primary)) !important;
  font-weight: 600 !important;
}

.dark #autoComplete_list {
  background-color: hsl(var(--card)) !important;
  border-color: hsl(var(--border)) !important;
}

.dark #autoComplete_list .autoComplete_result {
  background-color: hsl(var(--card)) !important;
  color: hsl(var(--foreground)) !important;
}

.dark #autoComplete_list .autoComplete_result:hover,
.dark #autoComplete_list .autoComplete_result[aria-selected="true"] {
  background-color: hsl(var(--accent)) !important;
  color: hsl(var(--accent-foreground)) !important;
}


