/* =========================================================================
   ModifMatch — thème conforme à la charte graphique LFPL
   Couleurs & typographies officielles. Couche au-dessus de Bootstrap 5.
   Accessibilité (WCAG AA) préservée.
   ========================================================================= */

:root {
  /* Bleus officiels LFPL */
  --lfpl-blue-dark: #2D427B;   /* bleu foncé  R45 V66 B123  */
  --lfpl-blue: #325491;        /* bleu        R50 V84 B145  */
  --lfpl-blue-mid: #416EA9;    /* bleu moyen  R65 V110 B169 */
  --lfpl-blue-bright: #5271FF; /* bleu vif    R82 V113 B255 (accents, gros éléments) */

  /* Couleurs d'accent officielles */
  --lfpl-red: #D8171C;         /* rouge       R216 V23 B28  */
  --lfpl-red-dark: #b31216;
  --lfpl-gold: #C19A2A;        /* doré        R193 V154 B42 */

  /* Fonctionnels / neutres */
  --success: #1f8a54;
  --success-hover: #196f44;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1c2540;
  --muted: #5b6b8c;
  --border: #e1e7f2;

  /* Rayons & ombres */
  --radius: 0.7rem;
  --radius-sm: 0.45rem;
  --shadow-sm: 0 1px 2px rgba(45, 66, 123, 0.08);
  --shadow: 0 6px 20px rgba(45, 66, 123, 0.10);

  /* Typographies charte */
  --font-titre: 'Arial Nova Condensed', 'Arial Narrow', 'Segoe UI', Arial, sans-serif;
  --font-corps: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* --- Base ------------------------------------------------------------- */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-corps);
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, .app-header__title {
  font-family: var(--font-titre);
  font-weight: 700;
  letter-spacing: 0.01em;
}
h1, h2, h3 { color: var(--lfpl-blue-dark); }
h1 { text-transform: uppercase; }

/* --- Bandeau d'en-tête institutionnel -------------------------------- */
.app-header {
  background: linear-gradient(100deg, var(--lfpl-blue-dark) 0%, var(--lfpl-blue) 60%, var(--lfpl-blue-mid) 100%);
  color: #fff;
  border-bottom: 3px solid var(--lfpl-gold); /* liseré doré charte */
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header__inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0;
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #fff !important;
}
.app-header__logo {
  background: #fff;
  border-radius: 12px;
  padding: 5px;
  display: inline-flex;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.app-header__logo img { height: 40px; width: auto; display: block; }
.app-header__title {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.app-header__subtitle {
  display: block;
  font-family: var(--font-corps);
  font-weight: 400;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
  color: #d7e0f2;
}
.app-header__login {
  flex-shrink: 0;
  min-height: auto;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  color: var(--lfpl-blue-dark) !important;
  background: #fff;
  border: 1px solid #fff;
  white-space: nowrap;
}
.app-header__login:hover,
.app-header__login:focus {
  background: #eef2fb;
  color: var(--lfpl-blue-dark) !important;
}

@media (max-width: 575.98px) {
  .app-header__title { font-size: 1rem; }
  .app-header__logo img { height: 32px; }
  .app-header__login { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
}

/* --- Contenu en carte ------------------------------------------------- */
main.container { max-width: 1160px; }
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* --- Boutons ---------------------------------------------------------- */
.btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background-color: var(--lfpl-blue);
  border-color: var(--lfpl-blue);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--lfpl-blue-mid);
  border-color: var(--lfpl-blue-mid);
}
.btn-primary:disabled { background-color: #93a2c4; border-color: #93a2c4; }

.btn-success { background-color: var(--success); border-color: var(--success); }
.btn-success:hover, .btn-success:focus { background-color: var(--success-hover); border-color: var(--success-hover); }

.btn-danger { background-color: var(--lfpl-red); border-color: var(--lfpl-red); }
.btn-danger:hover, .btn-danger:focus { background-color: var(--lfpl-red-dark); border-color: var(--lfpl-red-dark); }

.btn-secondary {
  background-color: #eef1f7;
  border-color: #d9e0ee;
  color: var(--lfpl-blue-dark);
}
.btn-secondary:hover, .btn-secondary:focus {
  background-color: #e2e8f4;
  border-color: #cdd6e8;
  color: var(--lfpl-blue-dark);
}

/* --- Texte blanc sur les boutons pleins (avant la règle des liens) ----- */
.btn-primary, .btn-success, .btn-danger,
.btn-primary:hover, .btn-primary:focus,
.btn-success:hover, .btn-success:focus,
.btn-danger:hover, .btn-danger:focus { color: #fff !important; }

/* --- Liens (contraste AA : bleu foncé lisible). On exclut les .btn et le bandeau ----- */
a:not(.btn):not(.app-header__brand), .link-primary { color: var(--lfpl-blue) !important; text-decoration: none; }
a:not(.btn):not(.app-header__brand):hover, .link-primary:hover { color: var(--lfpl-blue-mid) !important; text-decoration: underline; }

.btn-link-action {
  color: var(--lfpl-blue);
  background: none; border: none; padding: 0; min-height: auto;
  font-weight: 600; text-decoration: underline;
}
.btn-link-action:hover { color: var(--lfpl-red); }

/* --- Champs de formulaire --------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: 0.55rem 0.85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--lfpl-blue-mid);
  box-shadow: 0 0 0 0.2rem rgba(82, 113, 255, 0.20);
}
.form-label { font-weight: 600; color: var(--lfpl-blue-dark); margin-bottom: 0.3rem; }

/* --- Tableaux --------------------------------------------------------- */
.table-responsive {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.table { margin-bottom: 0; color: var(--text); }
.table > thead th {
  background: #eaf0fa;
  color: var(--lfpl-blue-dark);
  font-weight: 700;
  border-bottom: 2px solid var(--lfpl-blue-mid);
  white-space: nowrap;
}
.table > tbody td { vertical-align: middle; border-color: #eef1f7; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #fafbfe; }
.table tbody tr:hover > * { background-color: #eaf0fa; }
.table-success, .table-success > td { background-color: #e5f4ec !important; }

.pagination .page-link { color: var(--lfpl-blue); }
.pagination .page-item.active .page-link {
  background-color: var(--lfpl-blue);
  border-color: var(--lfpl-blue);
}

/* --- Badges ----------------------------------------------------------- */
.badge.bg-secondary { background-color: var(--muted) !important; }

/* --- Alertes ---------------------------------------------------------- */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.alert-success { background: #e5f4ec; border-color: #bfe3cf; color: #14603b; }
.alert-danger  { background: #fdeceb; border-color: #f4c4c3; color: #8c1013; }
.alert-info    { background: #eaf0fa; border-color: #cdddf3; color: var(--lfpl-blue-dark); }
.alert-warning { background: #fbf3e0; border-color: #ecd7a1; color: #6f5410; }

/* --- Focus visible (a11y) --------------------------------------------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--lfpl-blue-bright);
  outline-offset: 2px;
  box-shadow: none;
}

/* --- Skip link -------------------------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: var(--lfpl-blue-dark); color: #fff !important;
  padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* --- Bouton circulaire (conservé) ------------------------------------- */
.btn-circle {
  width: 30px; height: 30px; padding: 6px 0; border-radius: 15px;
  text-align: center; font-size: 12px; line-height: 1.42857; min-height: auto;
}

/* --- prefers-reduced-motion ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover { transform: none; }
}
