/* ============================================================
   PREFECTURE-THEME.CSS — Design System Prefecture B2B
   Diagnostic Organisationnel — Agents de Prefecture
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Brand Colors — Institutional */
  --pref-navy: #1E3A5F;
  --pref-navy-light: #2D5080;
  --pref-navy-dark: #132842;
  --pref-red: #C62828;
  --pref-red-light: #E53935;
  --pref-red-dark: #8E0000;
  --pref-blue-accent: #1565C0;
  --pref-blue-light: #42A5F5;

  /* Neutrals */
  --pref-bg: #F5F6F7;
  --pref-card: #FFFFFF;
  --pref-text: #1A1A2E;
  --pref-text-secondary: #5A5F7A;
  --pref-text-muted: #8B90A5;
  --pref-border: #E2E4EA;
  --pref-border-light: #F0F1F4;

  /* Semantic */
  --pref-success: #2E7D32;
  --pref-warning: #F57F17;
  --pref-danger: #C62828;
  --pref-info: #1565C0;

  /* Gauge / Heatmap Colors */
  --gauge-green: #2E7D32;
  --gauge-yellow: #F9A825;
  --gauge-orange: #EF6C00;
  --gauge-red: #C62828;
  --gauge-dark-red: #8E0000;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(30, 58, 95, 0.08);
  --shadow-md: 0 4px 12px rgba(30, 58, 95, 0.10);
  --shadow-lg: 0 8px 30px rgba(30, 58, 95, 0.12);
  --shadow-xl: 0 16px 48px rgba(30, 58, 95, 0.15);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --nav-height: 64px;
  --container-max: 1200px;
  --container-narrow: 800px;
  --container-xs: 600px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--pref-text);
  background-color: var(--pref-bg);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--pref-navy); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--pref-red); }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--pref-text);
}
h1 { font-size: var(--font-size-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--font-size-3xl); letter-spacing: -0.01em; }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); font-weight: 600; }
h6 { font-size: var(--font-size-base); font-weight: 600; }

.text-muted { color: var(--pref-text-muted); }
.text-secondary { color: var(--pref-text-secondary); }
.text-center { text-align: center; }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-lg { font-size: var(--font-size-lg); }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.container--narrow { max-width: var(--container-narrow); }
.container--xs { max-width: var(--container-xs); }

/* --- Navigation --- */
.nav {
  background: var(--pref-navy);
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}
.nav__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: #fff;
  font-weight: 700;
  font-size: var(--font-size-lg);
}
.nav__brand:hover { color: #fff; }
.nav__tagline {
  color: rgba(255,255,255,0.6);
  font-size: var(--font-size-xs);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}
.nav__links a {
  color: rgba(255,255,255,0.8);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
}
.nav__links a:hover,
.nav__links a.active {
  color: #fff;
}
.nav__links a.active {
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- Republique Header --- */
.republique {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
}
.republique__marianne {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
}
.republique__text {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
}
.republique__text span {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.08em;
}

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--pref-navy) 0%, var(--pref-navy-dark) 100%);
  color: #fff;
  padding: var(--space-3xl) 0;
  text-align: center;
}
.hero__content {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.hero h1 { color: #fff; margin-bottom: var(--space-md); font-size: var(--font-size-3xl); }
.hero__subtitle { color: rgba(255,255,255,0.85); font-size: var(--font-size-lg); line-height: 1.7; max-width: 600px; margin: 0 auto; }
.hero__badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-lg);
  backdrop-filter: blur(4px);
}

/* --- Sections --- */
.section {
  padding: var(--space-3xl) 0;
}
.section--alt {
  background: var(--pref-card);
}
.section__header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}
.section__header h2 { margin-bottom: var(--space-sm); }
.section__header p { color: var(--pref-text-secondary); font-size: var(--font-size-lg); }

/* --- Cards --- */
.card {
  background: var(--pref-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--pref-border-light);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card--clickable { cursor: pointer; }
.card--clickable:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.card--accent-top { border-top: 4px solid var(--pref-navy); }
.card--accent-red { border-top: 4px solid var(--pref-red); }
.card--accent-blue { border-top: 4px solid var(--pref-blue-accent); }
.card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}
.card__icon--navy { background: rgba(30,58,95,0.08); color: var(--pref-navy); }
.card__icon--red { background: rgba(198,40,40,0.08); color: var(--pref-red); }
.card__icon--blue { background: rgba(21,101,192,0.08); color: var(--pref-blue-accent); }
.card__title { font-size: var(--font-size-lg); margin-bottom: var(--space-sm); }
.card__text { font-size: var(--font-size-sm); color: var(--pref-text-secondary); line-height: 1.7; }

.card-grid {
  display: grid;
  gap: var(--space-lg);
}
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card-grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-xl);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.badge--navy { background: rgba(30,58,95,0.1); color: var(--pref-navy); }
.badge--red { background: rgba(198,40,40,0.1); color: var(--pref-red); }
.badge--blue { background: rgba(21,101,192,0.1); color: var(--pref-blue-accent); }
.badge--success { background: rgba(46,125,50,0.1); color: var(--pref-success); }
.badge--warning { background: rgba(245,127,23,0.1); color: var(--pref-warning); }
.badge--danger { background: rgba(198,40,40,0.1); color: var(--pref-danger); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
}
.btn--primary {
  background: var(--pref-navy);
  color: #fff;
  border-color: var(--pref-navy);
}
.btn--primary:hover {
  background: var(--pref-navy-light);
  border-color: var(--pref-navy-light);
  color: #fff;
}
.btn--danger {
  background: var(--pref-red);
  color: #fff;
  border-color: var(--pref-red);
}
.btn--danger:hover {
  background: var(--pref-red-light);
  border-color: var(--pref-red-light);
  color: #fff;
}
.btn--secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}
.btn--secondary:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.btn--outline {
  background: transparent;
  color: var(--pref-navy);
  border-color: var(--pref-border);
}
.btn--outline:hover {
  border-color: var(--pref-navy);
  background: rgba(30,58,95,0.04);
  color: var(--pref-navy);
}
.btn--lg { padding: 0.9rem 2rem; font-size: var(--font-size-base); }
.btn--sm { padding: 0.4rem 1rem; font-size: var(--font-size-xs); }
.btn--block { width: 100%; }

/* --- Steps --- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  counter-reset: step;
}
.step {
  text-align: center;
  position: relative;
}
.step__number {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--pref-navy);
  color: #fff;
  font-weight: 800;
  font-size: var(--font-size-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}
.step__title { font-weight: 700; margin-bottom: var(--space-xs); }
.step__text { font-size: var(--font-size-sm); color: var(--pref-text-secondary); }

/* --- Stat Cards --- */
.stat-card {
  display: flex;
  flex-direction: column;
  background: var(--pref-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--pref-border-light);
}
.stat-card__value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--pref-navy);
  line-height: 1;
}
.stat-card__label {
  font-size: var(--font-size-sm);
  color: var(--pref-text-secondary);
  margin-top: var(--space-xs);
}

/* --- Forms --- */
.form-group { margin-bottom: var(--space-lg); }
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--pref-text);
}
.form-label--required::after { content: ' *'; color: var(--pref-red); }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.7rem 1rem;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--pref-text);
  background: var(--pref-card);
  border: 2px solid var(--pref-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--pref-navy);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.12);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint {
  font-size: var(--font-size-xs);
  color: var(--pref-text-muted);
  margin-top: var(--space-xs);
}

/* --- Alerts --- */
.alert {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}
.alert__title { font-weight: 700; margin-bottom: var(--space-xs); }
.alert--info { background: rgba(21,101,192,0.06); border-left: 4px solid var(--pref-info); }
.alert--info .alert__title { color: var(--pref-info); }
.alert--warning { background: rgba(245,127,23,0.06); border-left: 4px solid var(--pref-warning); }
.alert--warning .alert__title { color: var(--pref-warning); }
.alert--danger { background: rgba(198,40,40,0.06); border-left: 4px solid var(--pref-danger); }
.alert--danger .alert__title { color: var(--pref-danger); }
.alert--success { background: rgba(46,125,50,0.06); border-left: 4px solid var(--pref-success); }
.alert--success .alert__title { color: var(--pref-success); }

/* --- Login Overlay --- */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  background: var(--pref-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}
.login-box {
  background: var(--pref-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2xl);
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.login-error {
  display: none;
  color: var(--pref-danger);
  font-size: var(--font-size-sm);
  margin-top: var(--space-sm);
}

/* --- Confidentiality --- */
.confidentiality {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--pref-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--pref-border);
}
.confidentiality__icon { margin-bottom: var(--space-lg); color: var(--pref-navy); }
.confidentiality__title { font-size: var(--font-size-xl); margin-bottom: var(--space-md); }
.confidentiality__text { color: var(--pref-text-secondary); font-size: var(--font-size-sm); line-height: 1.8; }

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  background: var(--pref-border);
  border-radius: 3px;
  margin-top: var(--space-sm);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pref-navy), var(--pref-blue-accent));
  border-radius: 3px;
  transition: width var(--transition-base);
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--pref-text-secondary);
  font-weight: 500;
}

/* --- Question Card --- */
.question-card {
  background: var(--pref-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--pref-border-light);
}
.question-card__block {
  font-size: var(--font-size-xs);
  color: var(--pref-navy);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}
.question-card__number {
  font-size: var(--font-size-xs);
  color: var(--pref-text-muted);
  margin-bottom: var(--space-md);
}
.question-card__text {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: var(--space-xl);
  color: var(--pref-text);
}
.question-card__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
}

/* --- Likert Scale --- */
.likert-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.likert-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.8rem 1rem;
  min-width: 80px;
  background: var(--pref-card);
  border: 2px solid var(--pref-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}
.likert-option:hover {
  border-color: var(--pref-navy-light);
  background: rgba(30,58,95,0.03);
}
.likert-option.selected {
  border-color: var(--pref-navy);
  background: rgba(30,58,95,0.08);
  box-shadow: var(--shadow-sm);
}
.likert-option__value { font-weight: 700; font-size: var(--font-size-lg); color: var(--pref-navy); }
.likert-option__label { font-size: var(--font-size-xs); color: var(--pref-text-muted); text-align: center; }

/* --- Radio Group --- */
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-option {
  padding: 1rem 1.25rem;
  background: var(--pref-card);
  border: 2px solid var(--pref-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
}
.radio-option:hover { border-color: var(--pref-navy-light); }
.radio-option.selected {
  border-color: var(--pref-navy);
  background: rgba(30,58,95,0.06);
}

/* --- Footer --- */
.footer {
  background: var(--pref-navy-dark);
  color: rgba(255,255,255,0.7);
  padding: var(--space-xl) 0;
  margin-top: auto;
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}
.footer__text { font-size: var(--font-size-sm); }
.footer a { color: rgba(255,255,255,0.5); }
.footer a:hover { color: #fff; }

/* --- Accordion --- */
.accordion__item {
  background: var(--pref-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--pref-border-light);
  overflow: hidden;
}
.accordion__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition-fast);
}
.accordion__header:hover { background: rgba(30,58,95,0.02); }
.accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}
.accordion__item.open .accordion__body { max-height: 15000px; }
.accordion__body-inner { padding: 0 var(--space-lg) var(--space-lg); }

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.5s ease forwards; }

/* --- Dashboard Filters --- */
.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: var(--pref-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--pref-border-light);
}
.dashboard-filters > div { flex: 1; min-width: 150px; }

/* --- Print --- */
@media print {
  .nav, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .section { padding: 1rem 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav__links { display: none; flex-direction: column; position: absolute; top: var(--nav-height); left: 0; right: 0; background: var(--pref-navy); padding: var(--space-lg); gap: var(--space-md); box-shadow: var(--shadow-lg); }
  .nav__links.open { display: flex; }
  .nav__toggle { display: block; }
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  .hero { padding: var(--space-2xl) 0; }
  .hero h1 { font-size: var(--font-size-2xl); }
  .steps { grid-template-columns: 1fr 1fr; }
  .likert-option { min-width: 60px; padding: 0.5rem; }
  .question-card { padding: var(--space-lg); }
  .footer__inner { flex-direction: column; text-align: center; }
}
