/* ====================================================================
   CHARTE GRAPHIQUE UNIFIÉE & ARCHITECTURE RESPONSIVE
   Projet : gestion-financio - Gestion Financière Personnelle
   Client : Bamanan Madou
   ==================================================================== */

:root {
  /* Palette Officielle Bamanan Madou - gestion-financio */
  --financio-blue: #0062cc; /* Bleu principal du logo (M) */
  --financio-blue-hover: #004da1; /* Bleu foncé pour les hovers */
  --financio-orange: #ff6a00; /* Orange dynamique (B) */
  --financio-orange-hover: #d45800; /* Orange foncé pour les hovers */
  --financio-green: #00b050; /* Vert du logo (Dépôts/Flux positifs) */
  --financio-gold: #ffcc00; /* Or des étoiles (Indicateurs clés) */

  --financio-white: #ffffff;
  --financio-light: #f4f7fc; /* Fond clair teinté de bleu de confiance */
  --financio-black: #0f172a; /* Slate sombre pour une typographie lisible */
  --financio-gray: #e2e8f0;
  --financio-muted: #64748b;
  --financio-danger: #ef4444; /* Pour les alertes de solde insuffisant */

  /* Ombres et design système */
  --card-shadow: 0 4px 12px rgba(0, 98, 204, 0.05);
  --sidebar-bg: #091e3a; /* Bleu nuit corporate pour le menu latéral */
  --sidebar-hover: #0c2952;
}

/* ====================================================================
   RÉINITIALISATION & TYPOGRAPHIE GLOBALE
   ==================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background-color: var(--financio-light);
  color: var(--financio-black);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Utilitaires de texte & couleurs spécifiques à gestion-financio */
.bg-muted {
  background: var(--financio-muted) !important;
}
.text-financio-blue {
  color: var(--financio-blue) !important;
}
.text-financio-orange {
  color: var(--financio-orange) !important;
}
.text-financio-green {
  color: var(--financio-green) !important;
}
.text-financio-gold {
  color: var(--financio-gold) !important;
}
.text-financio-black {
  color: var(--financio-black) !important;
}
.text-financio-muted {
  color: var(--financio-muted) !important;
}
.bg-financio-light {
  background-color: var(--financio-light) !important;
}
.bg-financio-blue {
  background-color: var(--financio-blue) !important;
}
.tracking-wide {
  letter-spacing: 0.05em;
}

/* Redéfinition des utilitaires Bootstrap standards */
.text-primary {
  color: var(--financio-blue) !important;
}
.text-secondary {
  color: var(--financio-orange) !important;
}
.text-danger {
  color: var(--financio-danger) !important;
}
.text-success {
  color: var(--financio-green) !important;
}
.text-warning {
  color: var(--financio-gold) !important;
}

/* ====================================================================
   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: #051427; /* Assombrissement du haut de la sidebar */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

#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: #cbd5e1;
  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(--financio-orange); /* L'orange du logo marque la page active */
}

#content {
  width: 100%;
  padding: 30px;
  transition: all 0.3s;
  min-width: 0;
}

/* ====================================================================
   COMPOSANTS DE CARTES HAUT DE GAMME (KPI & CARDS)
   ==================================================================== */
.card-financio {
  background-color: var(--financio-white) !important;
  border: 1px solid var(--financio-gray) !important;
  border-radius: 16px !important;
  box-shadow: var(--card-shadow) !important;
}

.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 rgba(0, 98, 204, 0.1);
}

.icon-shape {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

/* Stylisation du logo à la connexion */
.login-logo {
  max-width: 160px;
  height: auto;
}

/* ====================================================================
   BOUTONS ET COMPOSANTS TACTILES (TOUCH-TARGET MINIMUM 48PX)
   ==================================================================== */
.btn-primary {
  background: var(--financio-blue) !important;
  border-color: var(--financio-blue) !important;
  color: white !important;
}
.btn-primary:hover {
  background: var(--financio-blue-hover) !important;
}

.bg-secondary {
  background: var(--financio-orange) !important;
  border-color: var(--financio-orange) !important;
  color: white !important;
}

.btn-secondary {
  background: var(--financio-orange) !important;
  border-color: var(--financio-orange) !important;
  color: white !important;
}
.btn-secondary:hover {
  background: var(--financio-orange-hover) !important;
}

.btn-success {
  background: var(--financio-green) !important;
  border-color: var(--financio-green) !important;
  color: white !important;
}

.btn-outline-primary {
  color: var(--financio-blue) !important;
  border-color: var(--financio-blue) !important;
  background-color: transparent !important;
}

.btn-outline-danger {
  color: var(--financio-danger) !important;
  border-color: var(--financio-danger) !important;
  background-color: transparent !important;
}

.btn-outline-success {
  color: var(--financio-green) !important;
  border-color: var(--financio-green) !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover {
  color: white !important;
  background-color: var(--financio-blue) !important;
}

/* Bouton Spécifique pour les validations de caisse immédiates */
.btn-financio {
  background-color: var(--financio-orange) !important;
  color: var(--financio-white) !important;
  border: 1px solid var(--financio-orange) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  min-height: 48px;
  transition: all 0.2s ease-in-out !important;
}

.btn-financio:hover,
.btn-financio:focus {
  background-color: var(--financio-orange-hover) !important;
  border-color: var(--financio-orange-hover) !important;
  box-shadow: 0 4px 12px rgba(255, 106, 0, 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-financio {
  background-color: var(--financio-white) !important;
  border: 1px solid var(--financio-gray) !important;
  color: var(--financio-black) !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  font-size: 16px !important; /* Évite le zoom automatique sur iOS/Android */
  min-height: 48px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
}

.form-control-financio::placeholder {
  color: var(--financio-muted) !important;
}

.form-control-financio:focus {
  border-color: var(--financio-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 98, 204, 0.15) !important;
}

.input-group-text {
  background-color: var(--financio-light) !important;
  border: 1px solid var(--financio-gray) !important;
  color: var(--financio-black) !important;
  min-height: 48px;
}

/* Alertes d'erreurs et de succès (Solde bloqué ou validé) */
.alert-danger {
  background-color: #fee2e2 !important;
  border: 1px solid #fca5a5 !important;
  color: #991b1b !important;
}

.alert-success {
  background-color: #dcfce7 !important;
  border: 1px solid #86efac !important;
  color: #166534 !important;
}

/* ====================================================================
   LOGIQUE DE SCROLL HORIZONTAL DISPOSITIFS TACTILES (TABLES & CONTENUS)
   ==================================================================== */
.table-responsive-custom {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--financio-gray);
  background: #fff;
  margin-bottom: 1.5rem;
}

/* Stylisation universelle de TOUTES les barres de défilement aux couleurs du projet */

.table-responsive-custom::-webkit-scrollbar,
.row-scroll-mobile::-webkit-scrollbar,
 {
  height: 10px !important; /* Épaisseur idéale pour le doigt sur smartphone */
  display: block !important;
}


.table-responsive-custom::-webkit-scrollbar-track,
.row-scroll-mobile::-webkit-scrollbar-track,
 {
  background: var(--financio-light) !important;
  border-radius: 8px;
}


.table-responsive-custom::-webkit-scrollbar-thumb,
.row-scroll-mobile::-webkit-scrollbar-thumb,
 {
  background-color: var(
    --financio-blue
  ) !important; /* Le Bleu institutionnel du logo */
  border-radius: 8px;
  border: 2px solid var(--financio-light);
}

.custom-table th {
  background-color: #f8fafc;
  color: var(--sidebar-bg);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 16px;
  white-space: nowrap;
}

.custom-table td {
  padding: 16px;
  vertical-align: middle;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Force le conteneur principal de toutes les pages à défiler proprement si débordement */
.main-content-wrapper {
  overflow:auto;
  padding-bottom: 15px;
}


/* ====================================================================
   MEDIA QUERIES - RESPONSIVE GLOBAL 
   ==================================================================== */
@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;
  }

  /* Faire défiler horizontalement les cartes KPI 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: 220px !important; /* Taille parfaite pour les kpi financiers sur mobile */
  }
}

/* ===================================================
   CORRECTIF GLOBAL BOOTSTRAP MODAL - iPhone / Safari
=================================================== */

.modal{
    z-index:10600 !important;
}

.modal-backdrop{
    z-index:10590 !important;
}

.modal-dialog{
    pointer-events:auto;
}

.modal-content{
    pointer-events:auto;
    overflow:visible;
}

.modal-body{
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    max-height:75vh;
}

.modal input,
.modal textarea,
.modal select{
    font-size:16px !important;
    pointer-events:auto;
    user-select:text;
    -webkit-user-select:text;
    -webkit-touch-callout:default;
}

.modal button{
    pointer-events:auto;
}

@supports (-webkit-touch-callout:none){

.modal{
    position:fixed;
}

.modal-dialog{
    margin:20px auto;
}

}