/**
 * GLOBAL FIX DESIGN - Correctif couleurs texte
 * Charge en dernier pour corriger blanc-sur-blanc
 */

/* === VARIABLES FORCÉES (anti-cache ancien thème admin sombre) === */
:root,
body[data-theme="admin"],
body[data-role="ADMIN"],
body[data-theme="technician"],
body[data-role="TECHNICIAN"] {
  --text-primary: #111827 !important;
  --text-secondary: #4b5563 !important;
  --bg-card: #ffffff !important;
}

/* === FOND GLOBAL === */
body, html {
  background: #ffffff !important;
  color: #111827 !important;
}

#app {
  background: #ffffff !important;
  color: #111827 !important;
}

/* === PAGE DE CONNEXION === */
#login-page,
#login-page > div {
  background: #ffffff !important;
}
#login-page label {
  color: #111827 !important;
}
#login-page input {
  color: #111827 !important;
  background: #f9fafb !important;
}
#login-page h1 {
  color: #111827 !important;
}
#login-page button[type="submit"] {
  color: #ffffff !important;
}

/* === HEADER DE PAGE === */
.header {
  background: #ffffff !important;
  border-bottom: 2px solid #e5e7eb !important;
  color: #111827 !important;
}
.header h1, .header h2, .header h3, .header h4 {
  color: #111827 !important;
}

/* === TITRES GLOBAUX === */
h1, h2, h3, h4, h5, h6 {
  color: #111827 !important;
}

/* === PARAGRAPHES === */
p {
  color: #374151 !important;
}

/* === CARTES / SECTIONS === */
.card {
  color: #111827 !important;
  background: #ffffff;
}
.card h2, .card h3, .card h4 {
  color: #111827 !important;
}

/* === CONTENEUR PRINCIPAL === */
.container {
  color: #111827 !important;
}

/* === TABLEAUX === */
table, table th, table td,
.table-pro, .table-pro th, .table-pro td {
  color: #111827 !important;
}

/* === LABELS & INPUTS === */
label, .form-label, form label {
  color: #111827 !important;
}
input, select, textarea {
  color: #111827 !important;
}

/* === TEXT MUTED === */
.text-muted {
  color: #6b7280 !important;
}

/* =====================================================
   EXCEPTIONS : éléments qui DOIVENT rester en blanc
   ===================================================== */

/* Boutons */
.btn-primary, .btn-danger, .btn-success, .btn-warning, .btn-secondary,
.btn-primary *, .btn-danger *, .btn-success *, .btn-warning *, .btn-secondary * {
  color: #ffffff !important;
}

/* Bannière offline */
.offline-banner, .offline-banner * {
  color: #ffffff !important;
}

/* Badges compteurs arrondis avec fond FONCÉ uniquement (pas les fonds clairs du dashboard technicien) */
span[style*="background: #ea580c"],
span[style*="background:#ea580c"],
span[style*="background: #dc2626"],
span[style*="background:#dc2626"],
span[style*="background: #1e40af"],
span[style*="background:#1e40af"],
span[style*="background: #6b21a8"],
span[style*="background:#6b21a8"],
span[style*="background: #15803d"],
span[style*="background:#15803d"],
span[style*="background: #CA8A04"],
span[style*="background:#CA8A04"],
span[style*="background: #ca8a04"],
span[style*="background:#ca8a04"] {
  color: #ffffff !important;
}

/* Badges du dashboard technicien : texte selon leur couleur inline, pas blanc */
span[style*="background: #eff6ff"],
span[style*="background:#eff6ff"] { color: #1d4ed8 !important; }
span[style*="background: #fef2f2"],
span[style*="background:#fef2f2"] { color: #991b1b !important; }
span[style*="background: #fff7ed"],
span[style*="background:#fff7ed"] { color: #c2410c !important; }
span[style*="background: #f3e8ff"],
span[style*="background:#f3e8ff"] { color: #6b21a8 !important; }
span[style*="background: #fef3c7"],
span[style*="background:#fef3c7"] { color: #92400e !important; }
span[style*="background: #d1fae5"],
span[style*="background:#d1fae5"] { color: #065f46 !important; }
span[style*="background: #f3f4f6"],
span[style*="background:#f3f4f6"] { color: #374151 !important; }
span[style*="background: #dcfce7"],
span[style*="background:#dcfce7"] { color: #166534 !important; }
span[style*="background: #fffbeb"],
span[style*="background:#fffbeb"] { color: #92400e !important; }

/* En-têtes colorés du dashboard - NE PAS forcer blanc car les fonds sont clairs */
/* Les textes gardent leur couleur inline, seuls les badges (span avec background foncé) restent blancs */

/* Blocs avec fond foncé explicite */
[style*="background: #dc2626"],
[style*="background:#dc2626"],
[style*="background: #ea580c"],
[style*="background:#ea580c"],
[style*="background: #1e40af"],
[style*="background:#1e40af"],
[style*="background: #6b21a8"],
[style*="background:#6b21a8"],
[style*="background: #15803d"],
[style*="background:#15803d"],
[style*="background: #1e3a8a"],
[style*="background:#1e3a8a"],
[style*="background: #ca8a04"],
[style*="background:#ca8a04"] {
  color: #ffffff !important;
}

/* Titres de sections du dashboard - garder leurs couleurs spécifiques */
div[style*="font-weight: 800"][style*="color: #1e40af"] { color: #1e40af !important; }
div[style*="font-weight: 800"][style*="color: #6b21a8"] { color: #6b21a8 !important; }
div[style*="font-weight: 800"][style*="color: #15803d"] { color: #15803d !important; }
div[style*="font-weight: 800"][style*="color: #991b1b"] { color: #991b1b !important; }
div[style*="font-weight: 800"][style*="color: #9a3412"] { color: #9a3412 !important; }
div[style*="font-weight: 800"][style*="color: #854D0E"] { color: #854D0E !important; }
span[style*="font-weight: 800"][style*="color: #854D0E"] { color: #854D0E !important; }
span[style*="font-weight: 800"][style*="color: #991b1b"] { color: #991b1b !important; }

/* Sections non-conformes / réserve - titres colorés */
div[style*="font-weight: 700"][style*="color: #991b1b"] { color: #991b1b !important; }
div[style*="font-weight: 700"][style*="color: #581c87"] { color: #581c87 !important; }
div[style*="font-weight: 700"][style*="color: #854d0e"] { color: #854d0e !important; }
div[style*="font-weight: 700"][style*="color: #9a3412"] { color: #9a3412 !important; }

/* Titre "Tâches du Jour" - gris foncé */
.tasks-container h3,
h3.tasks-title {
  color: #374151 !important;
}

/* ═══ SIDEBAR ADMIN NAVIGATION (desktop only) ═══ */
#adminSideNav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 180px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,0.25);
  scrollbar-width: none;
}
#adminSideNav::-webkit-scrollbar { width: 0; }
#adminSideNav .sidebar-logo-area {
  padding: 0.5rem 0.5rem 0;
  text-align: center;
}
#adminSideNav .sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.25rem 0;
  flex: 1;
  overflow-y: auto;
}
#adminSideNav .snav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(220,38,38,0.25);
  transition: background 0.15s ease;
}
#adminSideNav .snav-link:hover {
  background: rgba(255,255,255,0.1);
  border-left-color: #dc2626;
}
#adminSideNav .snav-link.active {
  background: rgba(255,255,255,0.12);
  border-left-color: #dc2626;
  font-weight: 800;
}
#adminSideNav .snav-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  line-height: 1;
}
#adminSideNav .snav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 900px) {
  .nav-cards-bottom { display: none !important; }
}
@media (max-width: 899px) {
  #adminSideNav { display: none !important; }
  #app { margin-left: 0 !important; }
}
