/* ===== VARIABLES ===== */
:root {
  --navy:     #1B2A4A;
  --blue:     #2C5F8A;
  --orange:   #E8883A;
  --sage:     #2D6A4F;
  --purple:   #6D4C9F;
  --cyan:     #0E7490;
  --red:      #B91C1C;
  --l-blue:   #EAF2FB;
  --l-orange: #FDF4EC;
  --l-sage:   #D8F3DC;
  --l-purple: #EDE9FE;
  --lgrey:    #F3F4F6;
  --dgrey:    #374151;
  --white:    #FFFFFF;
  --border:   #E5E7EB;
  --shadow:   0 1px 3px rgba(0,0,0,.12);
  --shadow-md:0 4px 12px rgba(0,0,0,.1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: Arial, system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--dgrey);
  background: var(--lgrey);
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: Georgia, serif; color: var(--navy); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ===== LAYOUT ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 24px 0; }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--navy);
  color: white;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: var(--shadow);
}
.navbar-brand { font-family: Georgia, serif; font-size: 1.2rem; color: white; font-weight: bold; }
.navbar-brand span { color: var(--orange); }
.navbar-nav { display: flex; gap: 8px; align-items: center; }
.navbar-nav a { color: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 4px; font-size: .9rem; }
.navbar-nav a:hover { background: rgba(255,255,255,.1); color: white; text-decoration: none; }
.navbar-nav .btn-logout { background: rgba(255,255,255,.1); }

/* ===== CARTES ===== */
.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1.1rem; color: var(--navy); }

/* ===== BOUTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: .9rem; font-weight: bold; letter-spacing: .02em;
  transition: opacity .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-sage { background: var(--sage); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== FORMULAIRES ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: bold; font-size: .85rem; letter-spacing: .04em; color: var(--navy); margin-bottom: 5px; text-transform: uppercase; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .95rem; font-family: inherit; color: var(--dgrey);
  background: var(--white); transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(44,95,138,.15); }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: .8rem; color: #6B7280; margin-top: 4px; }
select.form-control { cursor: pointer; }

/* ===== TABLEAUX ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--l-blue); color: var(--navy); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; padding: 10px 12px; text-align: left; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #F9FAFB; }
tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: bold;
}
.badge-vert { background: var(--l-sage); color: var(--sage); }
.badge-orange { background: var(--l-orange); color: #B45309; }
.badge-gris { background: var(--lgrey); color: #6B7280; }
.badge-blue { background: var(--l-blue); color: var(--blue); }
.badge-purple { background: var(--l-purple); color: var(--purple); }

/* ===== PAGE LOGIN ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { background: white; border-radius: 12px; box-shadow: var(--shadow-md); padding: 40px; width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 2rem; color: var(--navy); }
.login-logo p { color: #6B7280; font-size: .9rem; }
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-danger { background: #FEF2F2; color: var(--red); border: 1px solid #FECACA; }
.alert-success { background: var(--l-sage); color: var(--sage); border: 1px solid #A7F3D0; }
.alert-info { background: var(--l-blue); color: var(--blue); border: 1px solid #BFDBFE; }

/* ===== DASHBOARD ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 8px; box-shadow: var(--shadow); padding: 20px; text-align: center; border-top: 3px solid var(--blue); }
.stat-card .stat-num { font-size: 2rem; font-weight: bold; color: var(--navy); font-family: Georgia, serif; }
.stat-card .stat-label { font-size: .85rem; color: #6B7280; margin-top: 4px; }

/* ===== PROGRESSION ===== */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s; }
.progress-fill.done { background: var(--sage); }

/* ===== ONGLETS ===== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; gap: 2px; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; font-size: .9rem; color: #6B7280; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
  text-decoration: none; transition: color .15s;
}
.tab:hover { color: var(--navy); text-decoration: none; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: bold; }

/* ===== FORMULAIRE BÉNÉFICIAIRE ===== */
.benef-page { max-width: 720px; margin: 0 auto; padding: 20px; }
.etape-progress { display: flex; gap: 4px; margin-bottom: 28px; }
.etape-dot {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border);
  transition: background .3s;
}
.etape-dot.done { background: var(--sage); }
.etape-dot.active { background: var(--blue); }
.etape-label { font-size: .85rem; color: #6B7280; margin-bottom: 8px; }
.question-block { background: white; border-radius: 10px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.question-titre { font-size: 1.05rem; color: var(--navy); font-weight: bold; margin-bottom: 8px; line-height: 1.4; }
.question-cle { display: inline-block; background: var(--l-orange); color: #B45309; font-size: .75rem; font-weight: bold; padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.question-timer { display: inline-block; background: var(--l-purple); color: var(--purple); font-size: .75rem; font-weight: bold; padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; margin-left: 4px; }
details.relances { margin-top: 10px; }
details.relances summary { font-size: .85rem; color: var(--blue); cursor: pointer; padding: 4px 0; }
details.relances ul { list-style: none; padding: 10px 0 0 0; }
details.relances ul li { font-size: .85rem; color: #6B7280; font-style: italic; padding: 3px 0 3px 16px; border-left: 2px solid var(--l-blue); margin-bottom: 4px; }
.save-indicator { font-size: .8rem; color: var(--sage); display: none; margin-top: 4px; }
.save-indicator.visible { display: inline-block; }
.form-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== ANALYSE GRILLES ===== */
.grille-section { margin-bottom: 28px; }
.grille-titre { font-size: 1rem; color: var(--navy); font-weight: bold; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.slider-group { display: grid; grid-template-columns: 200px 1fr 60px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: .85rem; }
.slider-group label { color: var(--dgrey); }
input[type=range] { width: 100%; accent-color: var(--blue); }
.slider-val { text-align: center; font-weight: bold; color: var(--navy); }
.alignement-group { display: flex; gap: 6px; }
.alignement-group label { font-size: .8rem; }
.correl-box { background: var(--l-blue); border-radius: 6px; padding: 12px 16px; margin-top: 12px; font-size: .9rem; }
.correl-box .correl-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }

/* ===== ROADMAP ===== */
.roadmap-grid { display: grid; grid-template-columns: 140px 1fr; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.roadmap-phase { background: var(--navy); color: white; padding: 14px 12px; font-size: .85rem; font-weight: bold; display: flex; align-items: center; }
.roadmap-cell { padding: 8px; border-bottom: 1px solid var(--border); }
.roadmap-cell:last-child, .roadmap-phase:last-child { border-bottom: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 8px 12px; font-size: .82rem; }
  .slider-group { grid-template-columns: 1fr; }
  .roadmap-grid { grid-template-columns: 1fr; }
  .roadmap-phase { border-radius: 0; }
}
@media (max-width: 640px) {
  .benef-page { padding: 12px; }
  .question-block { padding: 16px; }
  .card { padding: 16px; }
  h1 { font-size: 1.4rem; }
  .navbar-brand { font-size: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ===== DIVERS ===== */
.text-center { text-align: center; }
.text-muted { color: #6B7280; font-size: .85rem; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.copy-btn { cursor: pointer; background: none; border: none; color: var(--blue); font-size: .85rem; padding: 2px 6px; }
.lien-box { background: var(--l-blue); border-radius: 6px; padding: 12px 16px; font-size: .9rem; word-break: break-all; margin: 12px 0; display: flex; align-items: center; gap: 8px; }
.lien-box code { flex: 1; font-family: monospace; font-size: .85rem; }
.feu-go { color: #16A34A; } .feu-pret { color: #D97706; } .feu-attente { color: var(--red); }
.conf-page { max-width: 560px; margin: 60px auto; text-align: center; padding: 20px; }
.conf-page .checkmark { font-size: 4rem; margin-bottom: 16px; }
.erreur-page { max-width: 500px; margin: 80px auto; text-align: center; padding: 20px; }
.footer-text { text-align: center; padding: 20px; color: #9CA3AF; font-size: .8rem; border-top: 1px solid var(--border); margin-top: 20px; }
