/* ============================================================
   Efficience des soins — CPTS Grand Havre
   Feuille de style principale (site statique, sans dépendance)
   ============================================================ */

:root {
  --navy: #16263f;
  --navy-2: #1f3357;
  --navy-3: #2a4170;
  --coral: #e8654f;
  --coral-dark: #d4503a;
  --teal: #3fb8af;
  --gold: #e9b949;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #24344d;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 38, 63, .08);
  --shadow-lg: 0 10px 30px rgba(22, 38, 63, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; font-size: 16px; }
img { max-width: 100%; }
a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- En-tête ---------- */
header.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-lg);
}
.header-top { display: flex; align-items: center; gap: 18px; padding: 12px 22px 8px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; color: #fff; letter-spacing: -1px; flex-shrink: 0;
}
.brand-text b { display: block; font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 12.5px; color: #ffd9d0; display: block; line-height: 1.35; }
.header-search { flex: 1; min-width: 220px; max-width: 520px; margin-left: auto; position: relative; }
.header-search input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: none;
  font-size: 14.5px; background: rgba(255,255,255,.95); color: var(--text);
}
.header-search .loupe { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.btn-connexion {
  background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.55);
  border-radius: 999px; padding: 7px 16px; cursor: pointer; font-size: 13.5px; transition: all .2s;
}
.btn-connexion:hover { background: rgba(255,255,255,.12); }

/* ---------- Navigation ---------- */
nav.main-nav { display: flex; align-items: center; gap: 2px; padding: 0 14px 0; flex-wrap: wrap; }
nav.main-nav a {
  color: #fff; padding: 11px 13px; font-size: 14.5px; font-weight: 600;
  border-radius: 8px 8px 0 0; text-decoration: none; position: relative;
}
nav.main-nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
nav.main-nav a.active { color: var(--coral); }
nav.main-nav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 6px;
  height: 3px; border-radius: 2px; background: var(--coral);
}
.nav-burger { display: none; background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; padding: 4px 10px; }
.nav-item-dd { position: relative; }
.nav-dd {
  display: none; position: absolute; top: 100%; left: 0; background: #fff;
  border-radius: 0 0 12px 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 8px 0; z-index: 50;
}
.nav-item-dd:hover .nav-dd, .nav-item-dd:focus-within .nav-dd { display: block; }
.nav-dd a { display: block; color: var(--text) !important; padding: 9px 18px; font-weight: 500; border-radius: 0; }
.nav-dd a:hover { background: var(--bg); }
.nav-dd a.active::after { display: none; }

/* ---------- Mise en page ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 34px 22px 70px; min-height: 60vh; }
.hero {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-3) 70%, #355a8c 100%);
  color: #fff; border-radius: 22px; padding: 58px 46px; margin-bottom: 38px; position: relative; overflow: hidden;
}
.hero::after { content: "⚕"; position: absolute; right: -20px; bottom: -60px; font-size: 280px; opacity: .07; }
.hero h1 { font-size: clamp(28px, 4.5vw, 44px); line-height: 1.15; margin-bottom: 14px; }
.hero p.lead { font-size: clamp(16px, 2.2vw, 20px); color: #dbe6f5; max-width: 640px; }
.hero .hero-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block; background: var(--coral); color: #fff; font-weight: 700; border: none;
  border-radius: 999px; padding: 12px 24px; font-size: 15px; cursor: pointer;
  transition: transform .15s, background .2s; text-decoration: none !important;
}
.btn:hover { background: var(--coral-dark); transform: translateY(-1px); }
.btn.ghost { background: rgba(255,255,255,.14); border: 1.5px solid rgba(255,255,255,.5); }
.btn.ghost:hover { background: rgba(255,255,255,.25); }
.btn.teal { background: var(--teal); }
.btn.teal:hover { background: #34a098; }
.btn.small { padding: 8px 16px; font-size: 13.5px; }

h2.section-title {
  font-size: 26px; color: var(--navy); margin: 38px 0 18px; padding-bottom: 8px;
  border-bottom: 3px solid var(--coral); display: inline-block;
}
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; border: 1px solid var(--border); transition: transform .18s, box-shadow .18s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card h3 { color: var(--navy); margin-bottom: 8px; font-size: 18px; }
.card p { color: var(--muted); font-size: 14.5px; }
.card .pict { font-size: 34px; margin-bottom: 10px; }
.breadcrumb { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--coral); }

/* ---------- Fiches (accordéon) ---------- */
.fiche {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.fiche-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 22px; background: none; border: none; cursor: pointer; text-align: left;
  font-family: var(--font); font-size: 16px; font-weight: 650; color: var(--navy); line-height: 1.45;
}
.fiche-q:hover { background: #fafbfe; }
.fiche-q .qmark {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--coral);
  color: var(--coral); display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; transition: transform .25s, background .2s;
}
.fiche.open .fiche-q .qmark { background: var(--coral); color: #fff; transform: rotate(360deg); }
.fiche-a {
  display: none; padding: 4px 24px 22px; border-top: 1px dashed var(--border);
  white-space: pre-line; color: var(--text); font-size: 15.3px;
}
.fiche.open .fiche-a { display: block; animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.fiche-links { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; white-space: normal; }
.fiche-links a, .sub-chip {
  display: inline-block; background: #fdf3d7; border: 1px solid var(--gold); color: #7a5b12;
  font-size: 13px; font-weight: 600; font-style: italic; padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.fiche-links a:hover, .sub-chip:hover { background: var(--gold); color: #fff; text-decoration: none; }
.cat-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
  background: #e7f6f5; color: #20756f; border-radius: 999px; padding: 3px 10px;
  margin-bottom: 6px; text-transform: uppercase;
}

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 25, 42, .6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal {
  background: #fff; border-radius: 18px; max-width: 680px; width: 100%; max-height: 84vh;
  overflow-y: auto; padding: 34px 36px; position: relative; box-shadow: var(--shadow-lg); animation: fadeIn .25s;
}
.modal .close-x { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 24px; color: var(--muted); cursor: pointer; }
.modal h3 { color: var(--navy); margin-bottom: 14px; padding-right: 26px; }
.modal .modal-body { white-space: pre-line; font-size: 15.3px; }
.modal .idea { font-size: 36px; color: var(--gold); margin-bottom: 10px; }

/* ---------- Connexion ---------- */
.login-box { max-width: 430px; margin: 40px auto; }
.login-box .card { padding: 36px; }
.oauth-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; }
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 14px; color: var(--text);
  background: #fff; border: 1.5px solid var(--border); transition: .2s;
}
.btn-oauth:hover { background: var(--bg); text-decoration: none; }
.btn-oauth svg { flex: none; }
.oauth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 2px 0 16px; }
.oauth-sep::before, .oauth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13.5px; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: var(--font); background: #fff; color: var(--text);
}
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
.form-error { color: var(--coral-dark); font-size: 13.5px; margin-top: 8px; display: none; }
.lock-note {
  background: #fff8ed; border: 1px solid #f3ddb0; border-radius: var(--radius);
  padding: 18px 22px; font-size: 14.5px; color: #7a5b12; margin-bottom: 22px;
}

/* ---------- Chatbot ---------- */
#chatbot-fab {
  position: fixed; right: 22px; bottom: 22px; width: 62px; height: 62px; border-radius: 50%;
  background: var(--coral); color: #fff; border: none; font-size: 27px; cursor: pointer;
  box-shadow: 0 6px 22px rgba(232,101,79,.5); z-index: 250; transition: transform .2s;
}
#chatbot-fab:hover { transform: scale(1.08); }
/* Le bouton flottant « Contact » (widget du portail) est remonté pour ne pas
   recouvrir le bouton du chatbot, situé en bas à droite. */
.onkhc-btn { bottom: 96px !important; }
#chatbot-panel {
  position: fixed; right: 22px; bottom: 96px; width: 390px; max-width: calc(100vw - 30px);
  height: 560px; max-height: calc(100vh - 130px); background: #fff; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15,25,42,.35); display: none; flex-direction: column; overflow: hidden; z-index: 251;
}
#chatbot-panel.open { display: flex; animation: fadeIn .25s; }
.chat-head { background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff; padding: 15px 18px; display: flex; align-items: center; gap: 10px; }
.chat-head .dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; }
.chat-head b { font-size: 15.5px; }
.chat-head small { display: block; font-size: 12px; color: #c6d4e8; }
.chat-head .close-x { margin-left: auto; background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f2f5fa; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg.bot { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; box-shadow: var(--shadow); }
.msg.user { background: var(--navy-3); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.msg.bot .hit {
  display: block; margin-top: 8px; padding: 10px 12px; background: #f6f8fc; border: 1px solid var(--border);
  border-left: 3px solid var(--coral); border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.msg.bot .hit:hover { background: #eef2f9; }
.msg.bot .hit b { color: var(--navy); display: block; margin-bottom: 3px; }
.msg.bot .hit span { color: var(--muted); }
.msg.bot .hit .cat { font-size: 11px; color: #20756f; font-weight: 700; text-transform: uppercase; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-suggestions button { background: #fff; border: 1px solid var(--teal); color: #20756f; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.chat-suggestions button:hover { background: var(--teal); color: #fff; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; }
.chat-input input { flex: 1; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 999px; font-size: 14px; font-family: var(--font); }
.chat-input input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.chat-input button { background: var(--coral); color: #fff; border: none; border-radius: 50%; width: 42px; height: 42px; font-size: 17px; cursor: pointer; flex-shrink: 0; }

/* ---------- Équipe ---------- */
.team-card { text-align: center; }
.team-card .avatar {
  width: 86px; height: 86px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--navy-3));
  color: #fff; font-size: 30px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.team-card .avatar-photo {
  width: 86px; height: 86px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 12px;
  border: 2px solid var(--border); box-shadow: var(--shadow);
}
.theme-banner {
  display: block; width: 100%; height: clamp(150px, 22vw, 240px); object-fit: cover;
  border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow);
}

/* ---------- Fiches conseils patients & protocoles (in-site) ---------- */
.fp-col-title { font-size: 16px; color: var(--navy); margin: 22px 0 10px; }
.fp-theme { border: 1px solid var(--border); border-radius: 10px; background: var(--card); margin-bottom: 8px; overflow: hidden; }
.fp-theme > summary {
  list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.fp-theme > summary::-webkit-details-marker { display: none; }
.fp-theme > summary::before { content: "▸"; color: var(--teal); margin-right: 8px; transition: transform .2s; }
.fp-theme[open] > summary::before { transform: rotate(90deg); }
.fp-theme > summary:hover { background: var(--bg-soft, #f3f7f9); }
.fp-fiches { padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.fp-fiche {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-radius: 8px; padding: 9px 12px; cursor: pointer;
  font: inherit; font-size: 14.5px; color: var(--navy);
}
.fp-fiche:hover { background: #e7f6f5; }
.fp-fiche .fp-ico { flex-shrink: 0; }
.fiche-pdf { width: 100%; height: 76vh; border: 0; border-radius: 10px; background: #f4f6f8; }
.modal:has(.fiche-pdf) { max-width: 980px; }
.btn.ghost { background: none; border: 1px solid var(--teal); color: var(--teal); }

/* ---------- Vidéos / outils ---------- */
.video-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 9px;
}
.video-row .dur { flex-shrink: 0; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 4px 9px; font-variant-numeric: tabular-nums; }
.calc { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 28px; }
.calc .result { margin-top: 16px; background: #e7f6f5; border: 1px solid var(--teal); border-radius: 10px; padding: 16px 20px; font-size: 15.5px; display: none; }
.calc .result b { font-size: 22px; color: #20756f; }
iframe.embed-tool { width: 100%; height: 760px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* ---------- Commentaires ---------- */
.comment { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px; }
.comment .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

/* ---------- Pied de page ---------- */
footer.site-footer { background: var(--navy); color: #b9c7dd; text-align: center; padding: 34px 20px; font-size: 14px; }
footer.site-footer a { color: var(--teal); }
footer .foot-logo { height: 44px; width: auto; margin: 0 auto 12px; display: block; background: #fff; border-radius: 8px; padding: 6px 10px; }
footer .foot-brand { font-weight: 800; color: #fff; font-size: 16px; margin-bottom: 6px; }

/* ---------- Divers ---------- */
.notice { background: #eef6ff; border: 1px solid #bcd8f5; color: #23527c; border-radius: var(--radius); padding: 16px 20px; font-size: 14.5px; margin: 18px 0; }
.searchbar-page { position: relative; margin-bottom: 26px; }
.searchbar-page input { width: 100%; padding: 15px 20px 15px 48px; border-radius: 999px; border: 1.5px solid var(--border); font-size: 16px; box-shadow: var(--shadow); font-family: var(--font); }
.searchbar-page .loupe { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.count-pill { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filters button { background: #fff; border: 1.5px solid var(--border); border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.filters button.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-burger { display: block; margin-left: auto; }
  nav.main-nav { display: none; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  nav.main-nav.open { display: flex; }
  nav.main-nav a { border-radius: 8px; }
  nav.main-nav a.active::after { display: none; }
  .nav-dd { position: static; display: block; box-shadow: none; background: rgba(255,255,255,.07); border-radius: 8px; }
  .nav-dd a { color: #dbe6f5 !important; }
  .nav-dd a:hover { background: rgba(255,255,255,.1); }
  .header-search { order: 3; max-width: none; width: 100%; }
  .hero { padding: 40px 26px; }
  .modal { padding: 26px 22px; }
}
@media print {
  header.site-header, #chatbot-fab, #chatbot-panel, footer.site-footer { display: none; }
  .fiche-a { display: block !important; }
}
