/* ====================================================================
   CHARTE GRAPHIQUE UNIFIÉE & ARCHITECTURE RESPONSIVE
   Projets : Étoile Mandé & Banico Solar
   ==================================================================== */

:root {
  /* Banico Solar - Thème Lumineux Tactile */
  --solar-white: #ffffff;
  --solar-light: #f8f9fa;
  --solar-black: #111111;
  --solar-gray: #dee2e6;
  --solar-muted: #555555;
  --solar-gold: #dfb741;
  --solar-gold-hover: #cfa42b;
  --solar-danger: #dc3545;
  --solar-success: #198754;
}

/* ====================================================================
   RÉINITIALISATION & TYPOGRAPHIE GLOBAUTIQUE
   ==================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Utilitaires de texte génériques */
.bg-primary {
  background: var(--solar-gold);
  color: white;
}
.text-primary {
  color: var(--solar-gold) !important;
}
.text-solar-gold {
  color: var(--solar-gold) !important;
}
.text-solar-black {
  color: var(--solar-black) !important;
}
.text-solar-muted {
  color: var(--solar-muted) !important;
}
.bg-solar-light {
  background-color: var(--solar-light) !important;
}

.bg-solar-gold,
.bg-warning {
  background-color: var(--solar-gold) !important;
}
.tracking-wide {
  letter-spacing: 0.05em;
}

.text-primary {
  color: var(--solar-gold);
}

.text-secondary {
  color: var(--solar-black);
}

.text-danger {
  color: var(--solar-danger);
}

/* ====================================================================
   STRUCTURE DU LAYOUT FLEXIBLE (WRAPPER, SIDEBAR, CONTENT)
   ==================================================================== */
.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
  min-height: 100vh;
  position: relative;
}

#sidebar {
  min-width: 260px;
  max-width: 260px;
  background: var(--sidebar-bg);
  color: #fff;
  transition: all 0.3s ease;
  z-index: 999;
}

#sidebar .sidebar-header {
  padding: 20px;
  background: #020617;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar ul.components {
  padding: 20px 0;
  list-style: none;
  margin: 0;
}

#sidebar ul li a {
  padding: 12px 20px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
}

#sidebar ul li a i {
  margin-right: 12px;
  font-size: 1.2rem;
}

#sidebar ul li a:hover,
#sidebar ul li.active > a {
  color: #fff;
  background: var(--sidebar-hover);
  border-left: 4px solid var(--etoile-gold);
}

#content {
  width: 100%;
  padding: 30px;
  transition: all 0.3s;
  min-width: 0; /* Évite les ruptures de boîtes flexibles */
}

/* ==============================================================================
   COMPOSANTS REUTILISABLES ET CARTES (CARDS)
   ============================================================================== */
.card-solar {
  background-color: var(--solar-white) !important;
  border: 1px solid var(--solar-gray) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

/* Stylisation du Logo de connexion */
.login-logo {
  max-width: 140px;
  height: auto;
}

.tracking-wide {
  letter-spacing: 0.05em;
}

/* ====================================================================
   COMPOSANTS DE CARTES HAUT DE GAMME (KPI & SOLAR)
   ==================================================================== */
.kpi-card {
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--card-shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px 0 rgba(0, 0, 0, 0.08);
}

.card-solar {
  background-color: var(--solar-white) !important;
  border: 1px solid var(--solar-gray) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.icon-shape {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

/* ====================================================================
   BOUTONS ET COMPOSANTS TACTILES (TOUCH-TARGET MINIMUM 48PX)
   ==================================================================== */
.btn-primary {
  background: var(--solar-gold) !important;
  color: white;
}

.btn-secondary {
  background: var(--solar-black) !important;
  color: white;
}

.btn-outline-primary {
  color: var(--solar-gold);
  border-color: var(--solar-gold);
  background-color: transparent;
}

.btn-outline-primary:hover {
  color: white;
  background-color: var(--solar-gold);
}

.btn-solar {
  background-color: var(--solar-gold) !important;
  color: var(--solar-black) !important;
  border: 1px solid var(--solar-gold) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  min-height: 48px;
  transition: all 0.2s ease-in-out !important;
}

.btn-solar:hover,
.btn-solar:focus {
  background-color: var(--solar-gold-hover) !important;
  border-color: var(--solar-gold-hover) !important;
  color: var(--solar-black) !important;
  box-shadow: 0 4px 12px rgba(223, 183, 65, 0.25) !important;
}

.touch-target {
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ====================================================================
   FORMULAIRES OPTIMISÉS POUR APPAREILS MOBILES
   ==================================================================== */
.form-control-solar {
  background-color: var(--solar-white) !important;
  border: 1px solid var(--solar-gray) !important;
  color: var(--solar-black) !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  font-size: 16px !important; /* Évite le zoom automatique iOS/Android */
  min-height: 48px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
}

.form-control-solar:focus {
  border-color: var(--solar-gold) !important;
  box-shadow: 0 0 0 3px rgba(223, 183, 65, 0.2) !important;
}

/* ==============================================================================
   FORMULAIRES & LOGIQUE TACTILE (TOUCH-TARGET MINIMUM 48PX)
   ============================================================================== */
.form-control-solar {
  background-color: var(--solar-white) !important;
  border: 1px solid var(--solar-gray) !important;
  color: var(--solar-black) !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  font-size: 16px !important; /* Évite le zoom automatique forcé sur les navigateurs mobiles */
  min-height: 48px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
}

.form-control-solar::placeholder {
  color: #888888 !important;
}

.form-control-solar:focus {
  border-color: var(--solar-gold) !important;
  box-shadow: 0 0 0 3px rgba(223, 183, 65, 0.2) !important;
}

/* Éléments annexes du groupe d'input */
.input-group-text {
  background-color: var(--solar-light) !important;
  border: 1px solid var(--solar-gray) !important;
  color: var(--solar-black) !important;
  min-height: 48px;
}

/* Boutons d'action (Jaune du logo avec écritures noires) */
.btn-solar {
  background-color: var(--solar-gold) !important;
  color: var(--solar-black) !important;
  border: 1px solid var(--solar-gold) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  min-height: 48px; /* Hauteur tactile idéale pour les opérateurs */
  transition: all 0.2s ease-in-out !important;
}

.btn-solar:hover,
.btn-solar:focus {
  background-color: var(--solar-gold-hover) !important;
  border-color: var(--solar-gold-hover) !important;
  color: var(--solar-black) !important;
  box-shadow: 0 4px 12px rgba(223, 183, 65, 0.25) !important;
}

.touch-target {
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Alertes d'erreurs et de succès standardisées */
.alert-danger {
  background-color: #f8d7da !important;
  border: 1px solid #f5c2c7 !important;
  color: #842029 !important;
}

.alert-success {
  background-color: #d1e7dd !important;
  border: 1px solid #badbcc !important;
  color: #0f5132 !important;
}

/* ====================================================================
   LOGIQUE DE SCROLL HORIZONTAL DISPOSITIFS TACTILES (TABLES & CONTENUS)
   ==================================================================== */
.table-responsive-custom {
  width: 100%;
  overflow-x: auto; /* Force l'apparition du scroll horizontal si le contenu déborde */
  -webkit-overflow-scrolling: touch; /* Défilement à inertie super fluide sur iOS */
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: #fff;
  margin-bottom: 1.5rem;
}

/* Stylisation premium de la scrollbar horizontale */
.table-responsive-custom::-webkit-scrollbar {
  height: 8px; /* Hauteur légèrement augmentée pour faciliter le clic/touch */
}

.table-responsive-custom::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.table-responsive-custom::-webkit-scrollbar-thumb {
  background-color: var(--etoile-gold);
  border-radius: 10px;
}

/* Structures internes des tableaux défilants */
.custom-table th {
  background-color: #f1f5f9;
  color: var(--sidebar-bg);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 16px;
  white-space: nowrap; /* Empêche le texte de revenir à la ligne */
}

.custom-table td {
  padding: 16px;
  vertical-align: middle;
  font-size: 0.9rem;
  white-space: nowrap; /* Maintient l'alignement strict en ligne pour forcer le scroll propre */
}

/* ==============================================================================
   PROFIL DE SELECTION DE BOUTIQUE (POUR L'ADMINISTRATEUR)
   ============================================================================== */
.shop-profile-link {
  text-decoration: none !important;
  display: block;
}

.shop-profile-card {
  background-color: var(--solar-white);
  border: 1px solid var(--solar-gray);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.shop-profile-card:hover {
  transform: translateY(-5px);
  border-color: var(--solar-gold);
  box-shadow: 0 10px 20px rgba(223, 183, 65, 0.15);
}

/* Logo de boutique en format profil rond parfait demandé */
.shop-logo-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--solar-gold);
  object-fit: cover;
  margin: 0 auto 15px auto;
  background-color: var(--solar-white);
  padding: 2px;
  display: block;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.shop-title-text {
  color: var(--solar-black);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.shop-profile-card:hover .shop-title-text {
  color: var(--solar-gold-hover);
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

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

/* Classes utilitaires complémentaires */
.text-solar-black {
  color: var(--solar-black) !important;
}
.text-solar-gold {
  color: var(--solar-gold) !important;
}
.text-solar-muted {
  color: var(--solar-muted) !important;
}
.bg-solar-light {
  background-color: var(--solar-light) !important;
}

/* ====================================================================
   PROFIL DE BOUTIQUE & ANIMATIONS
   ==================================================================== */
.shop-profile-card {
  background-color: var(--solar-white);
  border: 1px solid var(--solar-gray);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.shop-profile-card:hover {
  transform: translateY(-5px);
  border-color: var(--solar-gold);
  box-shadow: 0 10px 20px rgba(223, 183, 65, 0.15);
}

.shop-logo-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--solar-gold);
  object-fit: cover;
  margin: 0 auto 15px auto;
  background-color: var(--solar-white);
  padding: 2px;
  display: block;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

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

/* ====================================================================
   MEDIA QUERIES - RESPONSIVE GLOBAL MASQUAGE SIDEBAR
   ==================================================================== */
@media (max-width: 768px) {
  .wrapper {
    flex-direction: column;
  }

  #sidebar {
    min-width: 100%;
    max-width: 100%;
    min-height: auto;
    display: none;
  }

  #sidebar.show {
    display: block !important;
  }

  #content {
    padding: 15px;
  }

  .kpi-card {
    margin-bottom: 10px;
  }
}

/* ==============================================================================
   PRO-FIX : RESPONSIVE GLOBAL & BARRES DE DÉFILEMENT HORIZONTALES (MOBILE/TABLET)
   ============================================================================== */

/* 1. Force le conteneur principal de toutes les pages à défiler proprement si le contenu déborde */
.main-content-wrapper {
  overflow: auto;
  padding-bottom: 15px;
}

/* 2. Protection universelle des Tableaux sur petits écrans (Évite l'écrasement des colonnes) */
@media (max-width: 991.98px) {
  /* Optionnel : Si vous voulez que vos lignes de cartes KPI défilent aussi de gauche à droite sur mobile */
  .row-scroll-mobile {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    gap: 12px;
  }
  .row-scroll-mobile > [class*="col-"] {
    flex: 0 0 auto !important;
    width: 190px !important; /* Taille fixe idéale par carte sur smartphone */
  }
}

/* 3. Stylisation universelle de TOUTES les barres de défilement aux couleurs de Banico Solar */
.main-content-wrapper::-webkit-scrollbar,
.row-scroll-mobile::-webkit-scrollbar,
div::-webkit-scrollbar {
  height: 10px !important; /* Épaisseur parfaite pour le passage du doigt */
  display: block !important;
}

.main-content-wrapper::-webkit-scrollbar-track,
.row-scroll-mobile::-webkit-scrollbar-track,
div::-webkit-scrollbar-track {
  background: var(--solar-light) !important;
  border-radius: 8px;
}

.main-content-wrapper::-webkit-scrollbar-thumb,
.row-scroll-mobile::-webkit-scrollbar-thumb,
div::-webkit-scrollbar-thumb {
  background-color: var(
    --solar-gold
  ) !important; /* Le Jaune/Or signature de votre logo */
  border-radius: 8px;
  border: 2px solid var(--solar-light);
}

.main-content-wrapper::-webkit-scrollbar-thumb:hover,
.row-scroll-mobile::-webkit-scrollbar-thumb:hover,
div::-webkit-scrollbar-thumb:hover {
  background-color: var(--solar-gold-hover) !important;
}
