/* =============================================================================
   DOKOTERA — Structure de page
   Principe directeur : le contenu n'occupe jamais toute la largeur de l'ecran.
   Une gouttiere (--gutter) reserve TOUJOURS un espace a gauche et a droite,
   et les espaces de travail ajoutent une colonne laterale de chaque cote.
   ========================================================================== */

/* --- Conteneur central ---------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--s-11);
}
.section-tight {
  padding-block: var(--s-9);
}

/* --- En-tete public ------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--s-7);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  flex-shrink: 0;
}

.brand__mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand__name {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand__tagline {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-400);
  font-weight: 700;
  margin-top: 3px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-right: auto;
}

.main-nav__link {
  white-space: nowrap;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--ink-600);
  transition: color var(--t-fast), background var(--t-fast);
}

.main-nav__link:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.main-nav__link.is-active {
  color: var(--ink);
  background: var(--brand-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* Connexion / inscription dans le menu mobile (masques sur grand ecran). */
.main-nav__auth {
  display: none;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
}

/* --- Pied de page --------------------------------------------------------- */

.site-footer {
  --px: 0;
  --py: 0;
  position: relative;
  margin-top: auto;
  overflow: hidden;
  isolation: isolate;
  background: #000;
  color: #d0d8d8;
  padding-block: var(--s-10) var(--s-6);
}
.site-footer > .container {
  position: relative;
  z-index: 1;
}

/* --- Decor anime (repris de la banniere d'accueil) ------------------------- */

.footer-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
/* Halo radial noir -> brun jaune, qui suit legerement la souris. */
.footer-fx__glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(
    circle at calc(30% + var(--px) * 12%) calc(40% + var(--py) * 12%),
    #06403e 0%,
    #041b1a 30%,
    #020606 60%,
    #000 100%
  );
  transition: background 0.4s ease-out;
}

/* Croix medicales qui montent (positions et rythmes fixes : pas de script). */
.footer-fx__rise {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.footer-fx__cross {
  position: absolute;
  bottom: -24px;
  width: 12px;
  height: 12px;
  opacity: 0;
  background:
    linear-gradient(var(--brand), var(--brand)) center / 100% 30% no-repeat,
    linear-gradient(var(--brand), var(--brand)) center / 30% 100% no-repeat;
  animation: footer-rise 16s linear infinite;
}
.footer-fx__cross:nth-child(1) { left: 6%; animation-duration: 15s; animation-delay: -2s; }
.footer-fx__cross:nth-child(2) { left: 14%; width: 8px; height: 8px; animation-duration: 19s; animation-delay: -9s; }
.footer-fx__cross:nth-child(3) { left: 24%; width: 16px; height: 16px; animation-duration: 22s; animation-delay: -5s; }
.footer-fx__cross:nth-child(4) { left: 35%; width: 9px; height: 9px; animation-duration: 17s; animation-delay: -13s; }
.footer-fx__cross:nth-child(5) { left: 47%; animation-duration: 20s; animation-delay: -1s; }
.footer-fx__cross:nth-child(6) { left: 58%; width: 18px; height: 18px; animation-duration: 24s; animation-delay: -15s; }
.footer-fx__cross:nth-child(7) { left: 68%; width: 8px; height: 8px; animation-duration: 16s; animation-delay: -7s; }
.footer-fx__cross:nth-child(8) { left: 77%; width: 14px; height: 14px; animation-duration: 21s; animation-delay: -11s; }
.footer-fx__cross:nth-child(9) { left: 87%; width: 10px; height: 10px; animation-duration: 18s; animation-delay: -4s; }
.footer-fx__cross:nth-child(10) { left: 95%; animation-duration: 23s; animation-delay: -17s; }

@keyframes footer-rise {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%, 80% { opacity: 0.3; }
  100% { transform: translateY(-460px) translateX(24px) rotate(180deg); opacity: 0; }
}

/* Pictogrammes flottants, deplaces par la souris (--px / --py). */
.footer-fx__floaters {
  position: absolute;
  inset: 0;
  transform: translate(calc(var(--px) * 30px), calc(var(--py) * 30px));
  transition: transform 0.25s ease-out;
}
.footer-fx__floater {
  position: absolute;
  color: var(--brand);
  animation: footer-float 7s ease-in-out infinite;
}
.footer-fx__floater svg {
  width: 100%;
  height: 100%;
}
.ff1 { top: 18%; left: 44%; width: 30px; height: 30px; opacity: 0.35; }
.ff2 { top: 62%; left: 38%; width: 38px; height: 38px; opacity: 0.18; animation-delay: -2s; }
.ff3 { top: 24%; left: 90%; width: 46px; height: 46px; opacity: 0.18; animation-delay: -4s; }
.ff4 { top: 70%; left: 82%; width: 22px; height: 22px; opacity: 0.4; animation-delay: -1s; color: var(--paper); }

@keyframes footer-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

@media (prefers-reduced-motion: reduce) {
  .footer-fx__cross,
  .footer-fx__floater {
    animation: none;
  }
  .footer-fx__cross {
    display: none;
  }
}

@media (max-width: 560px) {
  .ff1,
  .ff3 {
    display: none;
  }
}

.site-footer a {
  color: #d0d8d8;
  transition: color var(--t-fast);
}
.site-footer a:hover {
  color: var(--brand);
}

/* Quatre colonnes : marque, espace praticien, contact, informations. */
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--s-8);
}

.footer-col h4 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: var(--s-4);
}

.footer-col li + li {
  margin-top: var(--s-2);
}

.footer-about {
  margin-top: var(--s-4);
  max-width: 40ch;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink-300);
}

/* Moyen de paiement : logo Monegasy (variante fond sombre). */
.footer-pay {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  color: var(--ink-300);
}

.footer-muted {
  color: var(--ink-300);
}

.footer-bottom {
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--ink-300);
}

.site-footer .brand__name {
  color: var(--paper);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-grid > .footer-col:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }
  .footer-bottom {
    flex-direction: column;
    gap: var(--s-2);
  }
}

/* =============================================================================
   ESPACES DE TRAVAIL (patient / praticien / administrateur)
   Grille a trois colonnes : navigation a gauche — contenu — panneau a droite.
   ========================================================================== */

.workspace {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: var(--s-6) var(--s-10);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  gap: var(--s-6);
  align-items: start;
}

/* Pages sans panneau lateral droit. */
.workspace--wide {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* --- Colonne de gauche : navigation --------------------------------------- */

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--s-6));
  background: var(--ink);
  color: #c9d2d2;
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  max-height: calc(100vh - var(--header-h) - var(--s-9));
  overflow-y: auto;
}

.sidebar__identity {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
}

.sidebar__identity .avatar {
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar__name {
  font-weight: 700;
  color: var(--paper);
  font-size: var(--fs-base);
  line-height: 1.2;
}

.sidebar__role {
  font-size: var(--fs-xs);
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-top: 2px;
}

.sidebar__section-title {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-400);
  font-weight: 700;
  padding-inline: var(--s-3);
  margin-bottom: var(--s-2);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: var(--fs-base);
  color: #c9d2d2;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.sidebar__link.is-active {
  background: var(--brand);
  color: var(--ink);
}

.sidebar__link.is-active svg {
  color: var(--ink);
}

.sidebar__link svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar__badge {
  margin-left: auto;
  background: var(--brand);
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding-inline: 6px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar__link.is-active .sidebar__badge {
  background: var(--ink);
  color: var(--brand);
}

.sidebar__footer {
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* --- Colonne centrale ------------------------------------------------------ */

.workspace__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
}

.page-head__title {
  font-size: var(--fs-2xl);
  letter-spacing: -0.03em;
}

.page-head__subtitle {
  color: var(--ink-500);
  margin-top: var(--s-1);
  font-size: var(--fs-base);
}

/* --- Colonne de droite : panneau contextuel -------------------------------- */

.rail {
  position: sticky;
  top: calc(var(--header-h) + var(--s-6));
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  min-width: 0;
}

.rail__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

/* Icones des liens d'aide : taille fixe, teinte discrete, alignees au texte. */
.rail__card a svg,
.rail__card li svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink-400);
  transition: color var(--t-fast);
}

.rail__card a:hover svg {
  color: var(--ink);
}

.rail__title {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-400);
  font-weight: 700;
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

/* --- Adaptation aux petits ecrans ----------------------------------------- */

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .rail {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 900px) {
  .workspace,
  .workspace--wide {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: static;
    max-height: none;
    flex-direction: row;
    align-items: center;
    gap: var(--s-4);
    overflow-x: auto;
    padding: var(--s-3);
  }
  .sidebar__identity,
  .sidebar__section-title,
  .sidebar__footer {
    display: none;
  }
  .sidebar__nav {
    flex-direction: row;
    gap: var(--s-1);
  }
  .sidebar__link {
    white-space: nowrap;
  }
}

/* Menu ☰ des 1200 px : en dessous, logo + 4 liens + 2 boutons ne tiennent plus
   sur une ligne (liens sur plusieurs lignes, bouton d'inscription coupe). */
@media (max-width: 1200px) {
  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    padding: var(--s-4) var(--gutter) var(--s-6);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    /* Ferme : entierement remonte au-dessus de l'ecran ET masque, quelle que
       soit sa hauteur (sinon le bas du panneau depasse sous l'en-tete). */
    transform: translateY(calc(-100% - var(--header-h)));
    visibility: hidden;
    transition: transform var(--t-base), visibility 0s linear var(--t-base);
    gap: var(--s-1);
  }
  .main-nav.is-open {
    transform: translateY(0);
    visibility: visible;
    transition: transform var(--t-base), visibility 0s;
  }
  .nav-toggle {
    display: inline-flex;
    order: 3;
  }
  .site-header__inner {
    gap: var(--s-3);
    justify-content: space-between;
  }
  .main-nav__auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
  }
}

/* Petit telephone : le bouton d'inscription passe dans le menu. */
@media (max-width: 480px) {
  .header-actions .header-actions__signup {
    display: none;
  }
  .brand__tagline {
    display: none;
  }
}

/* Tres petit telephone : boutons du menu empiles sur toute la largeur. */
@media (max-width: 400px) {
  .main-nav__auth {
    grid-template-columns: 1fr;
  }
}


/* Gris secondaire eclairci sur fond sombre (contraste WCAG AA). */
.site-footer .brand__tagline,
.sidebar__section-title {
  color: #8c9898;
}
