/* =========================================================
   GLOBAL THEME (unified)
   - Keeps the existing app tokens (--bg, --accent, etc.)
   - Also exposes protocoles tokens (--color-*) for compatibility
   ========================================================= */

:root{
  /* canonical tokens (existing app) */
  --color-bg: white;
  --color-primary: #12b6c9;        /* turquoise */
  --color-primary-dark: #0c8693;
  --color-accent: #0f2d3d;
  --color-text: #1f2933;
  --color-muted: #6b7280;

  --radius: 8px;
  --shadow-soft: 0 4px 12px rgba(0,0,0,0.08);
  --transition-fast: 0.2s ease;

  /* app aliases (used widely in existing styles.css) */
  --bg: var(--color-bg);
  --panel: #ffffff;
  --text: var(--color-text);
  --muted: var(--color-muted);
  --border: rgba(31,41,51,.16);

  --accent: var(--color-primary);
  --accent2: var(--color-primary-dark);
  --accent_soft: rgba(18,182,201,.12);
  --shadow: var(--shadow-soft);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* IMPORTANT: avoid global typography side-effects (protocoles had p{justify})
   -> leave it to page-specific markup if needed. */
/* p { text-align: justify; } */


/* =========================================================
   LAYOUT / CONTAINERS
   ========================================================= */

.container{
  max-width:1100px;
  margin:0 auto;
  padding:14px;
}

/* optional modifier if you ever want protocoles spacing without conflicts */
.container.is-page{
  margin:24px auto 60px;
  padding:0 16px;
  max-width:900px;
}


/* =========================================================
   TOPBAR (existing app)
   ========================================================= */

.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(10px);
  padding: 12px 14px 14px;
}

@media (max-width: 720px){
  .topbar{
    position: sticky;
    backdrop-filter: none;
  }
}

.brand{text-align:center;}
.brand-title{ font-weight:1000; font-size:20px;}
.brand-subtitle{ color: var(--muted); font-size:13px; }


/* =========================================================
   PROTOCOLES HEADER / NAV (from protocoles.css)
   ========================================================= */

.site-header{
  position: relative;
  background: white;
  box-shadow: var(--shadow-soft);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo{
  font-weight: 700;
  font-size: 20px;
  color: var(--color-accent);
}

.logo span{ color: var(--color-primary); }

.site-header a{
  margin-left: 16px;
  text-decoration: none;
}

.site-header nav a{
  margin-left: 16px;
  text-decoration: none;
  color: var(--color-muted);
  font-size: 14px;
}

.site-header nav a:hover{
  color: var(--color-primary-dark);
}

/* Burger menu Quadruped (class names: .nav-toggle / .site-nav / .is-open) */
.nav-toggle{
  display:none;
  width:44px;height:44px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  padding:10px;
}

.nav-toggle .bar{
  display:block;
  height:2px;
  background:#111;
  margin:6px 0;
  border-radius:2px;
}

/* Desktop nav visible */
.site-nav{
  display:flex;
  align-items:center;
  gap:0;
}

/* Mobile: nav hidden except .is-open */
@media (max-width: 820px){
  .nav-toggle{ display:block; }

  .site-nav{
    display:none;
    position:absolute;
    right:12px;
    top:60px;
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
    padding:12px;
    background:#fff;
    border:1px solid rgba(0,0,0,.12);
    border-radius:12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
    min-width:240px;
    z-index:1000;
  }

  .site-nav.is-open{ display:flex; }
}

@media (max-width: 820px){
  #siteNav.site-nav{ display:none !important; }
  #siteNav.site-nav.is-open{ display:flex !important; }
}

.site-footer{
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--color-muted);
}


.centered-logo{
  display:block;
  margin:20px auto;
  width:40%;
  max-width:280px;
}

@media (max-width:600px){
  .centered-logo{
    width:40%;
  }
}


/* =========================================================
   FORMS / FIELDS (merged)
   ========================================================= */

.field label{
  font-size:12px;
  color:var(--muted);
  margin:8px 0 6px;
  display:block;
}

/* protocoles had global label{}; keep it but don’t override .field label specifics */
label{
  font-size:14px;
  color:var(--color-muted);
}

input, select{
  width:100%;
  background:#fff;
  border:1px solid #d1d5db;
  color:var(--text);
  padding:10px 12px;
  border-radius:var(--radius);
  font-size:14px;
  transition:var(--transition-fast);
}

/* protocoles had explicit types: keep compatibility */
input[type="text"],
input[type="email"],
input[type="password"]{
  /* rely on the common input rule; only ensure consistent padding */
  padding:10px 12px;
}

input:focus, select:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(18,182,201,.2);
}


/* =========================================================
   BUTTONS (merged)
   - .btn is your main app button
   - protocoles also uses .btn-primary/.btn-secondary/.btn-small
   ========================================================= */

.btn{
  display:inline-block;
  padding:8px 16px;
  border-radius:var(--radius);
  border:none;
  cursor:pointer;
  font-size:14px;
  text-decoration:none;
  text-align:center;
  transition: var(--transition-fast);

  background:var(--accent);
  color:white;
}

.btn:hover{ background:var(--accent2); }

.btn-primary{
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover{
  background: var(--color-primary-dark);
}

.btn-secondary{
  background:white;
  color:var(--accent);
  border:1px solid var(--accent);
}

.btn-secondary:hover{
  background: #e0f7fa;
}

.btn-small{
  padding:4px 10px;
  font-size:13px;
}

/* existing app buttons */
.open{
  border:1px solid var(--accent);
  background:white;
  color:var(--accent);
  padding:8px 12px;
  border-radius:var(--radius);
}

.star{
  border:1px solid #d1d5db;
  background:white;
  color:var(--accent);
  padding:8px 10px;
  border-radius:var(--radius);
}


/* =========================================================
   ACTIONS / FILTERS (existing app + protocoles)
   ========================================================= */

.actions{
  display:flex;
  gap:10px;
  margin-top:10px;
  flex-wrap:wrap;
}

/* protocoles used margin-top:16px; keep it without breaking the topbar layout */
.actions.is-spaced{
  margin-top:16px;
}

.filters{
  margin-top:10px;
  display:grid;
  gap:10px;
}

.grid2{
  display:grid;
  gap:10px;
  grid-template-columns:1fr 1fr;
}

@media (max-width:720px){
  .grid2{grid-template-columns:1fr;}
}

.meta{
  color:var(--muted);
  font-size:13px;
  margin:10px 0;
}

.hint{
  margin-top:8px;
  font-size:13px;
  color: var(--color-muted);
}


/* =========================================================
   CHIPS / TAGS (existing app)
   ========================================================= */

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

/* =========================================================
   CHIPS: selected state (Spécialités multi)
   Uses aria-pressed="true" from your buttons
   ========================================================= */

.chip{
  border:1px solid #d1d5db;
  background:white;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  transition: var(--transition-fast);
}

/* hover, not selected */
.chip:hover{
  border-color: rgba(18,182,201,.55);
  background: rgba(18,182,201,.06);
}

/* selected */
.chip[aria-pressed="true"]{
  border-color: var(--accent);
  background: var(--accent_soft);
  color: var(--accent2);
  font-weight: 650;
}

/* keyboard focus visibility */
.chip:focus-visible{
  outline:none;
  box-shadow: 0 0 0 3px rgba(18,182,201,.25);
}

.tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  max-width:100%;
}

.tag{
  font-size:12px;
  color:var(--accent2);
  border:1px solid rgba(18,182,201,.25);
  background:rgba(18,182,201,.08);
  padding:3px 8px;
  border-radius:999px;
  max-width:100%;
  overflow-wrap:anywhere;
}

.small{ color:var(--muted); font-size:12px; }

.tag.tag--danger{
  background:#fee2e2;
  border:1px solid #ef4444;
  color:#991b1b;
  font-weight:600;
}



/* =========================================================
   LISTS / CARDS (conflict-free merge)
   - Default .card = vertical (protocoles-friendly)
   - .list .card = horizontal (existing app "CARD FIX")
   ========================================================= */

.list{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  padding-bottom:18px;
  max-width:100%;
}

/* default card (protocoles forms, generic cards) */
.card,
.form-card{
  width:100%;
  max-width:100%;
  background:white;
  border-radius:var(--radius);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  box-shadow:var(--shadow-soft);
  margin-top:16px; /* protocoles expectation; harmless elsewhere */
}

/* existing app list cards: keep original horizontal layout inside .list */
.list .card{
  margin-top:0;              /* the list already has gap */
  flex-direction:row;
  gap:12px;
  align-items:center;
}

/* bloc gauche (existing app) */
.list .card > div:first-child{
  min-width:0;
  flex:1 1 auto;
}

/* bloc droit (existing app) */
.list .card > div:last-child{
  flex:0 0 auto;
}

/* mobile: boutons peuvent passer dessous */
@media (max-width:720px){
  .list .card{flex-wrap:wrap;}
  .list .card > div:last-child{width:100%;}
}

.list .card h3{
  margin:0 0 6px;
  font-size:16px;
  overflow-wrap:anywhere;
}


/* =========================================================
   FILTERS PANEL (existing app)
   ========================================================= */

.filters-panel{
  margin-top:10px;
  padding:12px;
  border-radius:var(--radius);
  background:white;
  box-shadow:var(--shadow-soft);
}

.filters-panel.is-collapsed{ display:none; }

.panel-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:10px;
}


/* =========================================================
   ALERTS (protocoles)
   ========================================================= */

.alert{
  padding:10px 12px;
  border-radius: var(--radius);
  margin-top:12px;
  font-size:14px;
}

.alert.success{
  background:#e0fce6;
  color:#166534;
}

.alert.error{
  background:#fee2e2;
  color:#b91c1c;
}

.alert.info{
  background:#e0f2fe;
  color:#1d4ed8;
}


/* =========================================================
   TABLE (protocoles)
   ========================================================= */

.table{
  width:100%;
  border-collapse: collapse;
  margin-top:16px;
  background:white;
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow-soft);
}

.table th, .table td{
  padding:8px 10px;
  font-size:14px;
}

.table th{
  background:#e5f6f8;
  text-align:left;
}

.table tr:nth-child(even){
  background:#f9fafb;
}


/* =========================================================
   BADGES (protocoles)
   ========================================================= */

.badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
}

.badge-locked{
  background:#e5e7eb;
  color:#4b5563;
}


/* =========================================================
   TOAST (protocoles)
   ========================================================= */

.toast{
  position:fixed;
  bottom:20px;
  right:20px;
  background:white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding:10px 14px;
  opacity:0;
  transform: translateY(10px);
  transition: var(--transition-fast);
  font-size:14px;
  z-index:9999;
}

.toast.visible{
  opacity:1;
  transform: translateY(0);
}

.toast.success{ border-left:4px solid #16a34a; }
.toast.error{ border-left:4px solid #dc2626; }
.toast.info{ border-left:4px solid var(--color-primary); }



/* =========================
   Quadruped Formation
   ========================= */

/* En-tête de page */
.page-head {
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--color-accent);
}

.page-head .muted {
  margin: 0;
  font-size: 0.875rem;
}

/* Grille des cartes */
.cards { display: grid; gap: 12px; }

/* Carte formation */
.formation-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  margin-top: 0;
}

.formation-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border-color: rgba(18,182,201,0.35);
}

.formation-card .card-body {
  padding: 18px 20px;
}

/* État actif : filet coloré à gauche quand le player est visible */
.formation-card:has(.formation-player:not([hidden])) {
  border-left: 3px solid var(--color-primary);
}

.formation-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.formation-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--color-accent);
  line-height: 1.3;
}

.formation-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--color-muted);
  line-height: 1.45;
}

.formation-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

/* Bouton "Voir la vidéo" avec icône ▶ */
.js-show::before {
  content: "▶";
  font-size: 0.7em;
  margin-right: 6px;
  opacity: 0.85;
}

/* Zone player */
.formation-player {
  margin-top: 0;
  padding: 0 20px 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* Wrapper sombre autour de la vidéo */
.formation-video-wrap {
  background: #0a1a22;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}

.video {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 0;
  background: #000;
}

.formation-player-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .formation-card .card-body { padding: 14px 16px; }
  .formation-player { padding: 12px 16px 14px; }
  .formation-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .formation-actions { width: 100%; }
  .formation-actions .btn { width: 100%; text-align: center; }
}


/* =========================================================
   HOME PAGE (index.php)
   ========================================================= */

/* Hero */
.home-hero {
  text-align: center;
  padding: 28px 16px 4px;
}
.home-hero img {
  width: 25%;
  margin-bottom: 14px;
}
.home-hero h1 {
  margin: 10px 0 4px;
  font-size: 1.65rem;
  letter-spacing: -.01em;
}
.home-hero .greeting {
  margin: 0;
  color: var(--color-muted);
  font-size: .95rem;
}

/* Modules grid */
.modules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}
@media (max-width: 580px) {
  .modules-grid { grid-template-columns: 1fr; }
}

/* Module cards */
.module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 16px 16px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
a.module-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.11);
  transform: translateY(-2px);
}
.module-card.locked {
  opacity: .58;
  cursor: default;
}
.module-card .mod-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: 12px;
}
.module-card h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 600;
}
.module-card .mod-desc {
  font-size: .82rem;
  color: var(--color-muted);
  line-height: 1.45;
}
.module-card .mod-badge {
  margin-top: 10px;
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0369a1;
  letter-spacing: .03em;
}
.module-card .mod-badge.locked-badge {
  background: #f3f4f6;
  color: #9ca3af;
}

/* PWA install banner */
.pwa-banner {
  display: none;
  margin-top: 18px;
  padding: 13px 15px;
  align-self: stretch;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
  border-radius: 12px;
  border-left: 4px solid #0097a7;
  font-size: .84rem;
  line-height: 1.55;
  color: #004d5e;
}
.pwa-banner strong {
  display: block;
  margin-bottom: 3px;
  font-size: .9rem;
}
.pwa-banner .material-symbols-outlined {
  font-size: 1.1em;
  vertical-align: -0.15em;
  line-height: 1;
}

/* Welcome (logged-out) */
.welcome-box {
  text-align: center;
  padding: 36px 16px 16px;
}
.welcome-box img {
  width: 25%;
  margin-bottom: 14px;
}
.welcome-box h1 {
  font-size: 1.7rem;
  margin: 0 0 8px;
}
.welcome-box p {
  color: var(--color-muted);
  margin-bottom: 26px;
}
.welcome-box .actions {
  justify-content: center;
}
