/* ==========================================================================
   COSAT — Design system
   Palette calquée sur le logo réel : marine (bouclier) + cyan (cadenas).
   Volontairement sobre — deux teintes de marque + neutres, pas de troisième
   couleur décorative (le vert/rouge/orange restent réservés aux badges de
   statut fonctionnels : disponible, erreur, en attente).
   Police auto-hébergée (Montserrat) : zéro dépendance externe (perf,
   confidentialité, pas d'exception CSP à ouvrir pour un CDN de polices).
   ========================================================================== */

:root {
  /* Palette calquée sur le vrai logo COSAT (bouclier marine + cadenas cyan). */
  --navy-900: #051740;
  --navy-800: #0b2149;
  --navy-700: #14315f;
  --navy-600: #1c4074;
  --navy-500: #2a5a94;

  --cyan: #157a9e;
  --cyan-dark: #0f5f7d;
  --cyan-light: #e5f5fa;
  --accent: #34c4e3;

  --white: #ffffff;
  --ink: #101c2b;
  --gray-700: #45536a;
  --gray-500: #5f6d80;
  --gray-300: #cfd7e2;
  --gray-100: #eef2f7;
  --bg: #f6f9fb;

  --success: #0e8a4b;
  --success-bg: #e6f7ee;
  --danger: #c0392b;
  --danger-bg: #fde8e8;
  --warning: #a6660b;
  --warning-bg: #fff4e0;

  --radius-sm: 6px;
  --radius: 14px;
  --radius-lg: 24px;

  --shadow-sm: 0 2px 8px rgba(7, 27, 48, .06);
  --shadow: 0 10px 30px rgba(7, 27, 48, .10);
  --shadow-lg: 0 24px 64px rgba(7, 27, 48, .18);

  --container: 1280px;
  --header-h: 122px;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Police auto-hébergée (fichier variable unique, poids 100-900) : aucune requête vers un CDN tiers,
   donc pas d'exception à ouvrir dans la Content-Security-Policy. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/montserrat-variable.woff2') format('woff2');
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.2; font-weight: 800; color: var(--navy-800); letter-spacing: -.01em; }
p { margin: 0 0 1em; color: var(--gray-700); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }
code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
section { padding: 96px 0; }
.section-tight { padding: 56px 0; }
.bg-white { background: var(--white); }
.bg-light { background: var(--bg); }
.bg-navy { background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); color: var(--white); }
.bg-navy h1, .bg-navy h2, .bg-navy h3, .bg-navy p { color: var(--white); }
.bg-navy p { color: #c3d2e2; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan-dark); background: var(--cyan-light);
  padding: 7px 16px; border-radius: 999px; margin-bottom: 18px;
}
.bg-navy .eyebrow { background: rgba(52, 196, 227, .18); color: #8fdcee; }

.section-head { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.section-head.align-left { margin: 0 0 36px; text-align: left; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  border: 2px solid transparent; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--cyan); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--cyan-dark); box-shadow: var(--shadow); }
.btn-outline { border-color: var(--navy-700); color: var(--navy-700); }
.btn-outline:hover { background: var(--navy-700); color: var(--white); }
.bg-navy .btn-outline { border-color: rgba(255,255,255,.5); color: var(--white); }
.bg-navy .btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-white { background: var(--white); color: var(--navy-800); }
.btn-white:hover { box-shadow: var(--shadow); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-danger { background: var(--danger); color: var(--white); }

/* ---------- Header ---------- */
.topbar { background: var(--navy-900); color: #a9bccf; font-size: .82rem; position: fixed; top: 0; left: 0; right: 0; z-index: 210; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 40px; }
.topbar-contact { display: flex; gap: 24px; }
.topbar-contact a { color: #a9bccf; }
.topbar-contact a:hover { color: var(--white); }
.topbar-actions { display: flex; gap: 20px; }
.topbar-actions a:hover { color: var(--white); }

.site-header {
  position: fixed; top: 40px; left: 0; right: 0; z-index: 200;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--gray-100);
}
.header-inner { display: flex; align-items: center; gap: 32px; height: 82px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark { height: 46px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.1rem; color: var(--navy-900); }
.brand-text small { font-size: .68rem; color: var(--gray-500); font-weight: 600; }

.main-nav ul { display: flex; gap: 4px; align-items: center; }
.main-nav ul li { flex-shrink: 0; }
.main-nav a { padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: .92rem; color: var(--navy-800); transition: background-color .15s, color .15s; white-space: nowrap; }
.main-nav a:hover, .main-nav a.is-active { background: var(--gray-100); color: var(--cyan-dark); }

.has-dropdown { position: relative; }
.dropdown {
  position: absolute; top: 100%; left: 0; margin-top: 8px; min-width: 260px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 10px; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.has-dropdown:hover .dropdown, .has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown ul li a { display: block; padding: 10px 12px; border-radius: 8px; font-size: .88rem; font-weight: 600; color: var(--navy-800); }
.dropdown ul li a:hover { background: var(--cyan-light); color: var(--cyan-dark); }
.dropdown-see-all { display: block; margin-top: 6px; padding: 10px 12px; border-top: 1px solid var(--gray-100); font-size: .82rem; font-weight: 700; color: var(--cyan-dark); }

.dropdown-mega { min-width: 580px; padding: 14px; }
.dropdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.dropdown-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 10px; }
.dropdown-item:hover { background: var(--cyan-light); }
.dropdown-item-icon {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--gray-100); color: var(--navy-700); font-size: 1rem;
}
.dropdown-item:hover .dropdown-item-icon { background: var(--white); color: var(--cyan-dark); }
.dropdown-item strong { display: block; font-size: .88rem; color: var(--navy-800); }
.dropdown-item small { display: block; font-size: .76rem; color: var(--gray-500); margin-top: 2px; line-height: 1.4; font-weight: 400; }

.header-actions { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--navy-900); border-radius: 2px; }

/* ---------- Alerts ---------- */
.alert { padding: 14px 20px; border-radius: var(--radius-sm); margin: 20px 0; font-weight: 600; font-size: .92rem; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--gray-100); color: var(--navy-700); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 108px 0 96px; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(700px 400px at 85% -10%, rgba(52, 196, 227,.25), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(37,99,163,.3), transparent 60%),
    url('/assets/img/hero-pattern.svg');
  background-size: auto, auto, cover;
  background-position: center, center, center;
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; position: relative; }
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.hero-stat strong { display: block; font-size: 1.6rem; color: var(--accent); }
.hero-stat span { font-size: .8rem; color: #c3d2e2; }
.hero-actions { display: flex; gap: 16px; margin-top: 36px; flex-wrap: wrap; }
.hero-visual {
  aspect-ratio: 4/5; border-radius: var(--radius-lg); background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.14); position: relative; overflow: hidden; box-shadow: var(--shadow-lg);
  display: grid; place-items: center;
}
.hero-visual img { width: 100%; height: 100%; object-fit: cover; position: relative; }

/* ---------- Grids & Cards ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

.card {
  background: var(--white); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

/* Cartes de grille dont le contenu varie en longueur (formations, sessions, matériels) :
   force une hauteur égale et un bouton toujours aligné en bas, quel que soit le texte. */
.card-stack { display: flex; flex-direction: column; height: 100%; }
.card-stack .card-clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.card-stack .card-cta { margin-top: auto; padding-top: 12px; }

.service-card { display: flex; flex-direction: column; gap: 14px; }
.service-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--cyan-light); color: var(--cyan-dark); font-size: 1.4rem;
}
.service-card h3 { font-size: 1.15rem; }
.service-card .more { font-weight: 700; color: var(--cyan-dark); font-size: .88rem; margin-top: auto; }

.capability-card { display: flex; gap: 20px; align-items: flex-start; }
.capability-num {
  flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--navy-800); color: var(--white);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
}
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tag { font-size: .74rem; font-weight: 700; background: var(--gray-100); color: var(--navy-700); padding: 4px 10px; border-radius: 999px; }

.stat-card { text-align: center; padding: 28px 20px; }
.stat-card h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cyan-dark); margin-bottom: 10px; }

.value-card { display: flex; gap: 18px; align-items: flex-start; }
.value-num { font-size: 1.6rem; font-weight: 800; color: var(--gray-300); flex: none; }

.team-card { text-align: center; }
.avatar {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--cyan-dark)); color: var(--white);
  display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
}
.team-card h4 { margin-bottom: 2px; font-size: 1.02rem; }
.team-role { color: var(--cyan-dark); font-weight: 700; font-size: .84rem; margin-bottom: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.badge-level-debutant { background: var(--gray-100); color: var(--navy-700); }
.badge-level-specialiste { background: #eef2fb; color: #3a4fc7; }
.badge-level-professionnel { background: var(--cyan-light); color: var(--cyan-dark); }
.badge-level-expert { background: #fdeee0; color: #b0631c; }
.badge-yes { background: var(--success-bg); color: var(--success); }
.badge-no { background: var(--gray-100); color: var(--gray-500); }
.badge-available { background: var(--success-bg); color: var(--success); }
.badge-onorder { background: var(--warning-bg); color: var(--warning); }
.badge-onhold { background: var(--warning-bg); color: var(--warning); }
.badge-suspended { background: var(--danger-bg); color: var(--danger); }

/* ---------- Fil de messages (demandes de formation) ---------- */
.msg-thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: .88rem; }
.msg-bubble .msg-meta { display: block; font-size: .72rem; color: var(--gray-500); margin-bottom: 4px; font-weight: 700; }
.msg-bubble.is-admin { align-self: flex-start; background: var(--gray-100); }
.msg-bubble.is-client { align-self: flex-end; background: var(--cyan-light); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 36px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  padding: 9px 18px; border-radius: 999px; border: 2px solid var(--gray-300); font-weight: 700; font-size: .85rem; color: var(--gray-700);
  background: var(--white); transition: all .15s ease;
}
.filter-pill:hover { border-color: var(--cyan); color: var(--cyan-dark); }
.filter-pill.is-active { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }
.filter-select { padding: 10px 14px; border-radius: var(--radius-sm); border: 2px solid var(--gray-300); font-weight: 600; background: var(--white); }
.filter-search { padding: 10px 16px; border-radius: var(--radius-sm); border: 2px solid var(--gray-300); flex: 1; min-width: 220px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-weight: 700; font-size: .88rem; color: var(--navy-800); }
.form-field .hint { font-size: .78rem; color: var(--gray-500); font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], select, textarea {
  padding: 13px 16px; border-radius: var(--radius-sm); border: 2px solid var(--gray-300); background: var(--white); color: var(--ink); font-size: .95rem;
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: none; }
textarea { resize: vertical; min-height: 130px; }
.field-error { color: var(--danger); font-size: .82rem; font-weight: 600; }

/* ---------- Images (uploads) ---------- */
.card-media {
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0;
  margin: -32px -32px 20px; background: var(--gray-100);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-photo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; margin: 0 auto 16px; display: block; }
.image-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.image-preview img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--gray-300); }
.image-preview .hint { display: flex; align-items: center; gap: 6px; font-weight: 600; }

/* ---------- Table (admin + listings) ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-100); background: var(--white); }
table.data-table th, table.data-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
table.data-table th { background: var(--gray-100); font-weight: 800; color: var(--navy-800); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--bg); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: #a9bccf; padding: 72px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-brand p { color: #a9bccf; margin: 16px 0; max-width: 32ch; }
.footer-social { display: flex; gap: 10px; }
.footer-social a { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.08); display: grid; place-items: center; font-weight: 700; }
.footer-social a:hover { background: var(--cyan); }
.footer-col h4 { color: var(--white); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 18px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col a:hover { color: var(--white); }
.footer-bottom { display: flex; justify-content: space-between; padding: 24px 0; font-size: .82rem; flex-wrap: wrap; gap: 10px; }
.footer-bottom a:hover { color: var(--white); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Breadcrumb */
.breadcrumb { font-size: .84rem; color: var(--gray-500); margin-bottom: 20px; display: flex; gap: 8px; }
.breadcrumb a:hover { color: var(--cyan-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --header-h: 70px; }
  .topbar, .header-actions .btn { display: none; }
  .site-header { top: 0; }
  .main-nav { position: fixed; top: 70px; left: 0; right: 0; bottom: 0; background: var(--white); padding: 20px; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; }
  .main-nav.is-open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; align-items: stretch; }
  .dropdown { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; display: none; margin: 4px 0 8px; }
  .has-dropdown.is-open .dropdown { display: block; }
  .dropdown-mega { min-width: 0; padding: 8px; }
  .dropdown-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .brand-text { display: none; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  section { padding: 60px 0; }
  .hero { padding: 56px 0 48px; }
}

/* ==========================================================================
   Back-office
   ========================================================================== */
body.admin-body { padding-top: 0; background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; flex: none; background: var(--navy-900); color: #c3d2e2; padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .brand { color: var(--white); margin-bottom: 28px; padding: 0 8px; }
.admin-sidebar .brand-text small { color: #7f93ab; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px; font-weight: 600; font-size: .9rem; color: #c3d2e2; margin-bottom: 2px; }
.admin-nav a:hover, .admin-nav a.is-active { background: rgba(255,255,255,.08); color: var(--white); }
.admin-nav .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #5f7690; margin: 18px 0 6px; padding: 0 14px; }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar { background: var(--white); border-bottom: 1px solid var(--gray-100); padding: 18px 32px; display: flex; justify-content: space-between; align-items: center; }
.admin-topbar h1 { font-size: 1.2rem; margin: 0; }
.admin-content { padding: 32px; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-tile { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.stat-tile strong { display: block; font-size: 1.8rem; color: var(--navy-800); }
.stat-tile span { font-size: .82rem; color: var(--gray-500); font-weight: 600; }

.actions-cell { display: flex; gap: 8px; }
.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(600px 400px at 15% 15%, rgba(52,196,227,.18), transparent 60%),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
}
.login-shell .card, .login-card { width: 100%; max-width: 420px; margin: 0 auto; box-shadow: var(--shadow-lg); }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
}
