/* =========================================
   1. VARIABLES & RESET GLOBAL
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.modern-wrapper {
  /* Palette de couleurs (Indigo Theme) */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  
  --bg-page: #f1f5f9;      /* Gris bleuté très clair */
  --bg-card: #ffffff;
  
  --header-bg: #1e293b;    /* Bleu nuit (Dark Slate) */
  --header-text: #ffffff;
  
  --text-main: #334155;    /* Gris foncé lisible */
  --text-muted: #64748b;   /* Gris moyen pour les labels */
  
  --border: #e2e8f0;       /* Gris clair pour les bordures */
  
  --row-hover: #f8fafc;
  --row-alt: #f1f5f9;      /* Zebra striping */

  /* Configuration Police */
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  padding: 20px;
  box-sizing: border-box;
}

/* Reset de base pour tous les éléments dans le wrapper */
.modern-wrapper * {
  box-sizing: border-box;
}

/* Titres H3 */
.modern-wrapper h3 {
  color: #0f172a;
  font-weight: 800;
  margin-bottom: 20px;
  margin-top: 0;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

/* =========================================
   2. CARTES & CONTENEURS
   ========================================= */
.modern-card {
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 25px;
}

/* =========================================
   3. FORMULAIRES (Grille & Flex)
   ========================================= */

/* Option A: Grille Responsive (Utilisé pour la liste Transports) */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  align-items: end; /* Aligne les champs et le bouton en bas */
}

/* Option B: Groupe Flex (Utilisé pour la recherche Facture simple) */
.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Styles des Inputs & Selects */
.input-group label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.modern-input, 
.modern-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  transition: all 0.2s;
  min-width: 0; /* Empêche les débordements flex */
}

.modern-input:focus, 
.modern-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* =========================================
   4. BOUTONS
   ========================================= */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  height: 35px; /* Hauteur standardisée */
}

/* Bouton Primaire (Bleu) */
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

/* Bouton Danger (Rouge contour) */
.btn-danger {
  background: white;
  border: 1px solid #ef4444;
  color: #ef4444;
}
.btn-danger:hover { background: #fef2f2; }

/* Bouton Icône (Petit carré pour "Voir" ou "Editer") */
.btn-icon {
  color: var(--primary);
  background: var(--primary-light);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: var(--primary);
  color: white;
}

/* =========================================
   5. TABLEAUX MODERNES
   ========================================= */
.table-container {
  overflow-x: auto; /* Scroll horizontal si écran trop petit */
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px; /* Taille standard lisible */
  white-space: normal;
}

/* En-tête */
.modern-table thead {
  background-color: var(--header-bg);
  color: var(--header-text);
}

.modern-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  white-space: nowrap; /* Les titres sur une ligne */
}

/* Corps */
.modern-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.modern-table td {
  padding: 10px 10px;
  vertical-align: top; /* Alignement haut pour gérer les textes longs */
  color: var(--text-main);
  line-height: 1.4;
}

/* Effet Zebra (Lignes alternées) */
.modern-table tbody tr:nth-child(even) {
  background-color: var(--row-alt);
}
.modern-table tbody tr:hover {
  background-color: var(--row-hover);
}

/* =========================================
   6. UTILITAIRES DE COLONNES & TEXTE
   ========================================= */

/* Force le texte à aller à la ligne (utile pour Articles/Descriptions) */
.wrap-text {
  white-space: normal !important;
  min-width: 180px;
  max-width: 300px;
}

/* Force le texte sur une ligne (Dates, ID, Chiffres) */
.no-wrap {
  white-space: nowrap;
}

/* Alignement Droite (Finances) */
.text-right {
  text-align: right;
}

/* Colonnes étroites pour icônes */
.col-action {
  width: 40px;
  text-align: center;
  padding: 8px 4px !important;
}

/* Images/Icones dans le tableau */
.table-icon {
  width: 22px;
  height: 22px;
  opacity: 0.8;
  transition: transform 0.2s, opacity 0.2s;
  display: inline-block;
  vertical-align: middle;
}
.table-icon:hover { opacity: 1; transform: scale(1.15); }

/* Format Monétaire (Chasse fixe pour alignement des virgules) */
.money-col {
  text-align: right;
  font-family: 'Courier New', Courier, monospace; 
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}
.currency { font-size: 10px; color: var(--text-muted); margin-left: 2px;}

/* Flèche de direction */
.arrowRight { text-align: center; }
.arrowRight img { opacity: 0.3; width: 16px; margin-top: 8px; }

/* =========================================
   7. BADGES & ETATS
   ========================================= */
.badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 0.5px;
}

/* Couleurs de Badges */
.badge-success { background: #dcfce7; color: #166534; } /* Vert */
.badge-warning { background: #fef9c3; color: #854d0e; } /* Jaune */
.badge-danger  { background: #fee2e2; color: #991b1b; } /* Rouge */
.badge-info    { background: #e0f2fe; color: #075985; } /* Bleu */
.badge-secondary { background: #f1f5f9; color: #64748b; } /* Gris */

/* Textes Spécifiques */
.txt-red { color: #dc2626; font-weight: bold; }
.txt-muted { color: #94a3b8; font-size: 11px; }

.badge-ref { 
  font-weight: 700; 
  color: var(--primary); 
  display:block; 
  margin-bottom: 2px;
}

.client-name { font-weight: 600; color: #1e293b; display: block; }
.client-loc { font-size: 11px; color: var(--text-muted); }



/* =========================================
   8. LAYOUTS DE VUE (Détails Dossier/Facture)
   ========================================= */

/* Grille 2 colonnes (Sidebar + Contenu principal) */
.view-grid {
  display: grid;
  grid-template-columns: 350px 1fr; /* Colonne gauche fixe, droite fluide */
  gap: 25px;
  align-items: start;
}

@media (max-width: 1024px) {
  .view-grid {
    grid-template-columns: 1fr; /* Passage en 1 colonne sur mobile/tablette */
  }
}

/* Style des listes de documents (Sidebar) */
.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-main);
}

.doc-item:hover {
  background-color: var(--row-hover);
}

.doc-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.doc-icon {
  color: var(--text-muted);
  font-size: 1.1em;
}
.doc-item:hover .doc-icon { color: var(--primary); }

/* Zone Iframe (PDF) */
.iframe-container {
  width: 100%;
  height: 850px;
  border: none;
  border-radius: 8px;
  background: #f1f1f1;
}

/* =========================================
   9. STEPPER (Pour le Tracking)
   ========================================= */
.stepper {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  position: relative;
}

.step-item {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
}

.step-item::before {
  content: '';
  position: absolute;
  top: 15px;
  left: -50%;
  width: 100%;
  height: 3px;
  background: var(--border);
  z-index: -1;
}

.step-item:first-child::before { display: none; }

.step-circle {
  width: 32px;
  height: 32px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: all 0.3s;
}

.step-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* État Actif / Complété */
.step-item.completed .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.step-item.completed .step-title { color: var(--primary); }
.step-item.completed::before { background: var(--primary); }

/* Carte pour la Map */
.map-card {
  padding: 0; /* Pas de padding pour que la map touche les bords */
  overflow: hidden;
  height: 700px;
}



/* =========================================
   10. PAGE DE CONNEXION (Login)
   ========================================= */

/* Le conteneur global qui centre tout */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85vh; /* Prend presque toute la hauteur */
  width: 100%;
  background-color: var(--bg-page);
}

/* La carte blanche centrale */
.login-card {
  background: white;
  width: 100%;
  max-width: 400px; /* Largeur idéale */
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); /* Ombre portée douce */
  border: 1px solid var(--border);
  position: relative;
}

/* En-tête de la carte (Logo) */
.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 180px; /* Taille ajustée */
  margin-bottom: 15px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

/* Sélecteur de langue (Positionné en haut à droite) */
.login-lang {
  position: absolute;
  top: 20px;
  right: 20px;
}

.lang-select-small {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  padding-right: 15px; /* Espace pour la flèche si besoin */
}
.lang-select-small:focus { outline: none; color: var(--primary); }

/* Champs de formulaire spécifiques Login */
.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Input avec icône à l'intérieur (Optionnel, sinon utilise modern-input standard) */
.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
}

.input-with-icon input {
  padding-left: 35px; /* Espace pour l'icône */
}

/* Bouton pleine largeur */
.btn-block {
  width: 100%;
  height: 42px; /* Un peu plus haut pour le login */
  font-size: 14px;
  margin-top: 10px;
}

/* Footer (Support) */
.login-footer {
  text-align: center;
  margin-top: 25px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.login-footer a:hover { text-decoration: underline; }