/* Option 2 — Thème via variables CSS (sombre par défaut)
   Définition d'un thème sombre cohérent et accessible pour tout le site.
   Vous pouvez ajuster les valeurs ci‑dessous pour affiner l'apparence. */

:root {
  /* Couleurs de base */
  --bg: #0f141a;            /* fond page */
  --surface: #141a22;       /* surfaces/cartouches */
  --surface-2: #1a2230;     /* variantes de surface */
  --text: #e8eef6;          /* texte principal */
  --text-subtle: #c3cfdd;   /* texte secondaire */
  --border: #2a3442;        /* contours discrets */
  --primary: #6ea8fe;       /* couleur d'accent */

  /* Variables de compatibilité (anciennes règles des templates) */
  --muted: var(--text-subtle);
  --link: var(--primary);
  --panel: rgba(255,255,255,0.06);
  --panel-border: rgba(255,255,255,0.15);
  --accent: #6ea8fe;
  --accent-2: #4b89e8;
  --sidebar-bg: rgba(255,255,255,0.04);
  --sidebar-border: rgba(255,255,255,0.12);
  --active: #153552;

  /* Effets */
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.30);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.25);
  --shadow: 0 10px 30px rgba(0,0,0,0.25);
  --radius: 14px;
}

/* Corps de page et textes */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  line-height: 1.5;
}

/* Liens */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--text-subtle); }

/* Messages flash (globaux) */
.flash {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
}
.flash.error {
  color: #ff6b6b; /* rouge lisible sur fond sombre */
  border-color: rgba(255, 0, 0, 0.35);
  background: rgba(255, 0, 0, 0.08);
}
.flash.success {
  color: #8fe29a;
  border-color: rgba(0, 255, 128, 0.25);
  background: rgba(0, 255, 128, 0.06);
}
.flash.warning {
  color: #ffd27d;
  border-color: rgba(255, 200, 0, 0.35);
  background: rgba(255, 200, 0, 0.08);
}
.flash.info {
  color: #9ecbff;
  border-color: rgba(110, 168, 254, 0.35);
  background: rgba(110, 168, 254, 0.08);
}

/* Liens de sélection de langue */
.lang-link {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  color: var(--text);
  background: rgba(255,255,255,0.06);
  transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.lang-link:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.lang-link.active, .lang-link[aria-current="true"] {
  background: var(--primary);
  color: #0b0f14;
  border-color: rgba(255,255,255,0.10);
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(110,168,254,0.25) inset;
}

/* Surfaces génériques (cartes/encarts) */
.card, .panel, .modal, .dropdown-menu, .toast, .tooltip, .offcanvas, .badge, .navbar {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Variante de surface */
.surface-2, .card.alt, .panel.alt { background: var(--surface-2); }

/* Boutons (style neutre) */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { background: #1b2534; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Taille renforcée pour boutons d'action principaux */
.btn-lg {
  padding: 12px 18px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

/* Bouton primaire */
.btn-primary { background: var(--primary); color: #0b0f14; border-color: rgba(255,255,255,0.08); }
.btn-primary:hover { filter: brightness(0.95); }

/* Accessibilité: focus visible harmonisé avec la charte */
.btn:focus-visible,
.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Champs de formulaire */
input, select, textarea {
  background: rgba(0,0,0,0.30);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }

/* Sélecteur de langue compact harmonisé */
.lang-select {
  padding: 6px 10px;
  background: rgba(0,0,0,0.30);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}
.lang-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(110,168,254,0.25);
}

/* Tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 12px; }
.table th { color: var(--text-subtle); text-align: left; }

/* Barres et overlays translucides utiles sur images ou cartes */
.translucent {
  background-color: rgba(0,0,0,0.55);
  backdrop-filter: saturate(140%) blur(6px);
  border: 1px solid rgba(255,255,255,0.20);
  color: #fff;
}

/* Respect des préférences système (mode sombre) — Optionnel si site uniquement sombre */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #141a22;
    --surface-2: #1a2230;
    --text: #e8eef6;
    --text-subtle: #c3cfdd;
    --border: #2a3442;
    --primary: #6ea8fe;
  }
}

/* Sidebar menu styles (shared) */
.menu{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.menu a.btn, .menu button{
  appearance:none;border:0;background:transparent;color:var(--text);
  text-align:left;padding:10px 12px;border-radius:10px;font-size:15px;cursor:pointer;
  display:flex;align-items:center;gap:10px;transition:background .2s ease, transform .02s ease;
}
.menu a.btn:hover, .menu button:hover{background:rgba(255,255,255,.06)}
.menu a.btn.active, .menu button.active{background:var(--active)}

/* Brand link styles for sidebar (keeps look consistent while making title clickable) */
.brand .brand-link,
.brand .title {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.brand .brand-link:hover,
.brand .title:hover { opacity: .9; }

/* Brand logo square showing Id_Shark */
.brand .logo{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px; min-width: 28px;
  border-radius: 8px;
  background: linear-gradient(145deg,var(--accent),var(--accent-2));
  box-shadow: var(--shadow);
  color: #fff; /* text in white as requested */
  font-weight: 900;
  font-size: 10px; /* fits up to ~5 chars */
  line-height: 1;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Aero sidebar and menu enhancements */
/* 1) Supprimer le soulignement des liens partout (dont le survol) */
a { text-decoration: none; }
a:hover { text-decoration: none; }

/* 2) Look de la sidebar (métal brossé/avionique) */
.sidebar{
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)) padding-box,
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,0.08), transparent 50%) border-box,
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 6px) border-box;
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: saturate(120%) blur(6px);
}

/* Accent latéral façon « rail » */
.sidebar{ position: relative; }
.sidebar::before{
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 6px;
  background: linear-gradient(180deg,#27405e,#1a2a3e);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 0 10px rgba(0,0,0,0.35);
}

/* 3) Boutons du menu — base plus « cockpit » */
.menu a.btn, .menu button{
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.15)),
    #1a2330;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 6px 18px rgba(0,0,0,0.25);
  border-radius: 12px;
  letter-spacing: .2px;
}
.menu a.btn:hover, .menu button:hover{
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.18)),
    #223044;
  transform: translateY(-1px);
}
.menu a.btn:active, .menu button:active{ transform: translateY(0); filter: brightness(.98); }
.menu a.btn.active, .menu button.active{
  background:
    linear-gradient(180deg, rgba(80,140,255,0.24), rgba(0,0,0,0.20)),
    #17304a;
  border-color: rgba(110,168,254,0.55);
  box-shadow:
    inset 0 0 0 1px rgba(110,168,254,0.35),
    0 8px 22px rgba(59,130,246,0.28);
}

/* Unified nav-button for sidebar items (alternative option) */
.menu a.nav-button, .menu button.nav-button{
  appearance: none;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .2s ease, transform .02s ease;
  position: relative;
  /* cockpit look */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.15)),
    #1a2330;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 6px 18px rgba(0,0,0,0.25);
  /* typography akin to previous btn-aero */
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .6px;
}
.menu a.nav-button:hover, .menu button.nav-button:hover{
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.18)),
    #223044;
  transform: translateY(-1px);
}
.menu a.nav-button:active, .menu button.nav-button:active{ transform: translateY(0); filter: brightness(.98); }
.menu a.nav-button.active, .menu button.nav-button.active{
  background:
    linear-gradient(180deg, rgba(80,140,255,0.24), rgba(0,0,0,0.20)),
    #17304a;
  border-color: rgba(110,168,254,0.55);
  box-shadow:
    inset 0 0 0 1px rgba(110,168,254,0.35),
    0 8px 22px rgba(59,130,246,0.28);
}

/* 4) Variante « aéronautique » explicite pour certains boutons */
.btn-aero{
  text-transform: uppercase;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .6px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.22)),
    #17202c;
  border: 1px solid rgba(255,255,255,0.18);
}
.btn-aero:hover{ background:
  linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.25)), #1c2a39; }

/* 5) Bouton « Importation » avec bandes jaunes diagonales type hazard tape */
.btn-import{
  color: #111;
  font-weight: 800;
  background:
    repeating-linear-gradient(45deg, #ffd400 0 14px, #111 14px 28px);
  border-color: #ffdf40;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.btn-import:hover{
  filter: brightness(1.05);
}
/* Liseré et relief pour le côté industriel */
.btn-import::before{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -1px 0 rgba(0,0,0,0.35);
  pointer-events: none;
}
/* Animation douce des bandes pour donner vie (respecte prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference){
  .btn-import{ background-size: 28px 28px; animation: stripes 12s linear infinite; }
  @keyframes stripes{ to{ background-position: 280px 0; } }
}

/* 6) Icônes mieux alignées dans le menu */
.menu a.btn > .icon{ width: 1.25em; text-align: center; opacity: .95; }

/* Global layout to keep sidebar on the left across all pages */
.layout{
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100svh;
}
/* Sidebar sizing/positioning without overriding its visual theme above */
.sidebar{
  position: sticky;
  top: 0;
  align-self: start;
  height: 100svh;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.spacer{ flex: 1; }

/* Responsive: stack sidebar on small screens */
@media (max-width: 860px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--sidebar-border); border-radius: 0; }
}


/* Page container defaults for consistent layout across views */
.main{ padding:28px; max-width:1280px; width:100%; }
.wrap{ max-width:1200px; margin:0 auto; }

/* Headings and subtitles consistency */
h1{ margin:0 0 10px; font-size:28px; }
h2{ margin:0 0 10px; font-size:20px; }
.subtitle{ color:var(--muted); margin:0 0 20px; }

/* Responsive adjustments for main container */
@media (max-width: 980px){ .main{ padding:18px } }


/* ---- Score card (touchdown) styles: homogeneous with site theme ---- */
.score-card {
  margin-bottom: 10px;
  border-left: 4px solid var(--accent);
}
.score-card .score-header {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.score-card .metrics {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.score-card .metric .label {
  color: var(--text-subtle);
  font-size: .92rem;
  margin-bottom: 2px;
}
.score-card .metric .value {
  font-size: 1.05rem;
  font-weight: 600;
}
