/* SavedTheKine — feuille de style */

:root {
  --primary: #0d9488;       /* teal — kiné / santé */
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --accent: #2563eb;
  --bg: #f4f7f6;
  --card: #ffffff;
  --border: #e5e9e8;
  --text: #10231f;
  --text-muted: #5f7570;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,35,31,0.04), 0 8px 24px -12px rgba(16,35,31,0.10);
  --shadow-hover: 0 4px 12px rgba(16,35,31,0.06), 0 16px 32px -12px rgba(16,35,31,0.16);
}

* { box-sizing: border-box; }

/* Liens "texte" (dans les tableaux, listes, paragraphes...) : couleur unique de la charte,
   pas de souligné, et surtout pas de changement de couleur une fois visité/cliqué —
   contrairement au bleu/violet par défaut du navigateur. */
a {
  color: var(--primary-dark);
  text-decoration: none;
}
a:hover { color: var(--primary); text-decoration: underline; }
a:visited, a:active, a:focus { color: var(--primary-dark); }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ HEADER ============ */
header.site {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
header.site .brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--primary-light);
  border-radius: 10px;
  font-size: 1.05rem;
}
header.site nav {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  background: var(--bg-soft, #f3f7f6);
  border-radius: 12px;
  padding: 4px;
}
header.site nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
header.site nav a .nav-ico { font-size: 0.95rem; line-height: 1; }
header.site nav a:hover { background: rgba(13,148,136,0.12); color: var(--primary-dark); }
header.site nav a.active {
  background: var(--primary);
  color: white;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(13,148,136,0.35);
}
header.site nav .nav-logout { color: var(--text-muted); margin-left: 6px; }
header.site nav .nav-logout:hover { background: var(--danger-bg); color: var(--danger); }
header.site nav .btn-nav {
  background: var(--primary);
  color: white !important;
}
header.site nav .btn-nav:hover { background: var(--primary-dark); }
.who {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-niveau {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ============ LAYOUT ============ */
main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px 0; }
p { color: var(--text-muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ============ FILTERS ============ */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.filters label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: block;
  margin-bottom: 6px;
}

label { font-size: 0.85rem; font-weight: 600; color: var(--text); }

select, input[type=text], input[type=email], input[type=password], input[type=number], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============ CHAMPS DATE (calendrier flatpickr) ============ */
input.flatpickr-input, input[data-input] {
  cursor: pointer;
  background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" stroke="%230d9488" stroke-width="1.8"><rect x="2" y="3.5" width="14" height="12.5" rx="2"/><path d="M2 7h14M6 1.5v3M12 1.5v3"/></svg>') no-repeat right 12px center;
  padding-right: 38px;
}

/* thème flatpickr aligné sur la palette du site */
.flatpickr-calendar { box-shadow: var(--shadow-hover); border-radius: var(--radius); border: 1px solid var(--border); }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months { color: var(--text); }
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--primary);
  border-color: var(--primary);
}
.flatpickr-day.today { border-color: var(--primary); }
.flatpickr-day:hover { background: var(--primary-light); }
span.flatpickr-weekday { color: var(--text-muted); font-weight: 600; }

/* ============ TAGS / BADGES ============ */
.tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 2px 4px 0 0;
}

/* ============ STAGE CARDS ============ */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.stage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.stage-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stage-card-clickable { cursor: pointer; }
.stage-card-clickable form, .stage-card-clickable button, .stage-card-clickable a { cursor: auto; }
.stage-card h3 { margin: 0 0 4px 0; font-size: 1.05rem; font-weight: 700; }
.stage-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 10px; line-height: 1.5; }
.places { font-weight: 700; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.places::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.places.ok { color: var(--success); }
.places.ok::before { background: var(--success); }
.places.full { color: var(--danger); }
.places.full::before { background: var(--danger); }

/* ============ BUTTONS ============ */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:active, .btn:active { transform: scale(0.98); }
.btn.secondary { background: #eef1f0; color: var(--text); }
.btn.secondary:hover { background: #e1e6e4; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.danger:hover { background: #fee2e2; }

/* ============ TABLES ============ */
table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafcfb; }

/* Tableau "dense" (vue tableur avec beaucoup de colonnes, ex: admin/organismes.php) :
   ne force pas 100% de largeur, laisse les en-têtes sur une ligne, et défile horizontalement
   dans son conteneur (overflow-x:auto) plutôt que d'écraser chaque colonne. */
table.table-dense { width: auto; min-width: 100%; }
table.table-dense th { white-space: nowrap; padding: 10px 14px; }
table.table-dense td { white-space: nowrap; padding: 10px 14px; }
table.table-dense td.wrap { white-space: normal; }

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.alert.success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }

.wish-rank {
  font-weight: 800;
  color: white;
  background: var(--primary);
  border-radius: 999px;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

form.inline { display: inline; }

.empty {
  color: var(--text-muted);
  font-style: normal;
  text-align: center;
  padding: 48px 20px;
  background: var(--card);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
}

/* Variante légère de ".empty" pour un petit espace réservé en ligne (ex: dans une cellule de
   tableau) — sans le gros padding/bordure en tirets qui n'a de sens que pour un bloc "aucun résultat". */
.empty-inline {
  color: var(--text-muted);
}

/* ============ DASHBOARD STAT CARDS ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card.accent { background: var(--primary); border-color: var(--primary); }
.stat-card.accent .stat-value, .stat-card.accent .stat-label { color: white; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; margin-top: 4px; }

/* ============ HERO (page d'accueil, visiteurs non connectés) ============ */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
  margin: -12px -24px 32px;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
  border-radius: 0 0 28px 28px;
}
.hero h1 {
  font-size: 2.1rem;
  max-width: 640px;
  margin: 0 auto 10px;
}
.hero-sub {
  max-width: 560px;
  margin: 0 auto 28px;
  color: var(--text-muted);
  font-size: 1rem;
}
.hero-roles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 860px;
  margin: 0 auto;
}
.hero-role-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.hero-role-icon {
  font-size: 1.8rem;
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 50%;
}
.hero-role-card h3 { margin: 0 0 6px 0; font-size: 1.05rem; font-weight: 700; }
.hero-role-card p { font-size: 0.86rem; margin: 0 0 16px 0; }

.section-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 16px 0; }

/* ============ MOBILE NAV ============ */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--text);
}

@media (max-width: 640px) {
  .site-inner { padding: 12px 16px; }
  main { padding: 20px 16px 48px; }
  h1 { font-size: 1.4rem; }
  .hero { padding: 32px 16px 28px; border-radius: 0 0 20px 20px; margin: -12px -16px 24px; }
  .hero h1 { font-size: 1.5rem; }

  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  header.site nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 10px;
  }
  header.site nav.open { display: flex; }
  header.site nav a, header.site nav .who { margin-left: 0; width: 100%; }
  .site-inner { flex-wrap: wrap; }

  #toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { width: 100%; }
}

/* ============ TOASTS (notifications de confirmation) ============ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--text);
  color: white;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}
.toast-success { background: var(--primary-dark); }
.toast-success .toast-icon { background: rgba(255,255,255,0.2); }
.toast-error { background: var(--danger); }
.toast-error .toast-icon { background: rgba(255,255,255,0.25); }

/* Liste déroulante stylisée pour la suggestion de villes (remplace la datalist native) */
.ville-autocomplete { position: relative; }
.ville-autocomplete-liste {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  max-height: 220px;
  overflow-y: auto;
}
.ville-autocomplete-liste li {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}
.ville-autocomplete-liste li:hover,
.ville-autocomplete-liste li:active {
  background: var(--primary-light);
  color: var(--primary-dark);
}
