/* ==========================================================================
   Fondation Apaisia — Plateforme de gestion clients & rendez-vous
   Charte graphique : lavande / violet profond / blanc cassé
   ========================================================================== */

:root {
  --lavande: #C6B7D8;
  --lavande-clair: #EFEAF5;
  --lavande-voile: #F3EFF8;
  --violet-grise: #8E859B;
  --violet-profond: #4B3F5D;
  --violet-encre: #392F47;
  --blanc-casse: #F7F6F9;
  --blanc: #FFFFFF;

  --sauge: #9FAFA3;
  --lin: #D8CFC4;
  --gris-chaud: #6E6A67;
  --rose-poudre: #E3B7C2;

  --bordure: #E7E2EE;
  --texte: #4F4759;
  --ombre-douce: 0 2px 18px rgba(75, 63, 93, .06);
  --ombre-carte: 0 6px 32px rgba(75, 63, 93, .09);
  --rayon: 16px;
  --rayon-sm: 10px;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  background: var(--blanc-casse);
  color: var(--texte);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--violet-profond);
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
}

a { color: var(--violet-profond); }

.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--violet-grise);
  font-weight: 700;
  margin: 0 0 10px;
}

/* ==========================================================================
   Page de connexion
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 620px at 50% -10%, #FBF7FC 0%, rgba(251, 247, 252, 0) 62%),
    linear-gradient(180deg, var(--blanc-casse) 0%, var(--lavande-voile) 100%);
}

/* Signature : voile de lumière lavande qui respire lentement en arrière-plan */
.halo {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  pointer-events: none;
  animation: respire 16s ease-in-out infinite;
}
.halo-1 { width: 460px; height: 460px; top: -140px; left: -110px; background: var(--lavande); }
.halo-2 { width: 380px; height: 380px; bottom: -130px; right: -90px; background: var(--rose-poudre); opacity: .38; animation-delay: -6s; }
.halo-3 { width: 300px; height: 300px; top: 42%; right: 16%; background: var(--sauge); opacity: .22; animation-delay: -11s; }

@keyframes respire {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(0, -26px, 0) scale(1.08); }
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: 22px;
  padding: 44px 40px 38px;
  box-shadow: var(--ombre-carte);
}

.login-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--lavande) 0%, var(--violet-profond) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.login-mark span {
  font-family: var(--serif);
  color: var(--blanc);
  font-size: 24px;
  line-height: 1;
}

.login-card h1 { font-size: 30px; margin-bottom: 8px; }
.login-card .sub { color: var(--violet-grise); font-size: 14.5px; margin: 0 0 30px; }

.login-foot {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--bordure);
  font-size: 12.5px;
  color: var(--violet-grise);
  text-align: center;
}

/* ==========================================================================
   Formulaires
   ========================================================================== */

.field { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--violet-profond);
  margin-bottom: 7px;
  letter-spacing: .01em;
}
label .opt { font-weight: 400; color: var(--violet-grise); }
label .req { color: var(--rose-poudre); margin-left: 2px; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--violet-encre);
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
input::placeholder, textarea::placeholder { color: #B7B0C0; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lavande);
  box-shadow: 0 0 0 3px rgba(198, 183, 216, .35);
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--violet-profond);
  outline-offset: 2px;
}

textarea { resize: vertical; min-height: 86px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238E859B' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 20px; }

/* ==========================================================================
   Boutons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--violet-profond); color: var(--blanc); }
.btn-primary:hover:not(:disabled) { background: var(--violet-encre); box-shadow: 0 6px 20px rgba(75, 63, 93, .22); }

.btn-soft { background: var(--lavande-clair); color: var(--violet-profond); border-color: var(--bordure); }
.btn-soft:hover:not(:disabled) { background: var(--lavande); color: var(--violet-encre); }

.btn-ghost { background: transparent; color: var(--violet-grise); border-color: var(--bordure); }
.btn-ghost:hover:not(:disabled) { color: var(--violet-profond); border-color: var(--lavande); }

.btn-block { width: 100%; }

/* ==========================================================================
   En-tête applicatif
   ========================================================================== */

.topbar {
  background: var(--blanc);
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(140deg, var(--lavande) 0%, var(--violet-profond) 100%);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-mark span { font-family: var(--serif); color: #fff; font-size: 17px; }
.brand-text strong { display: block; font-family: var(--serif); font-size: 17px; color: var(--violet-profond); font-weight: 500; line-height: 1.2; }
.brand-text small { color: var(--violet-grise); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; }

.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--violet-grise);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.tab:hover { color: var(--violet-profond); background: var(--lavande-voile); }
.tab.active { background: var(--lavande-clair); color: var(--violet-profond); }

/* ==========================================================================
   Contenu
   ========================================================================== */

.wrap { max-width: 1080px; margin: 0 auto; padding: 40px 24px 80px; }

.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: 32px; margin-bottom: 6px; }
.page-head p { color: var(--violet-grise); margin: 0; max-width: 62ch; }

.card {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 30px;
  box-shadow: var(--ombre-douce);
  margin-bottom: 24px;
}
.card > h2 { font-size: 21px; margin-bottom: 4px; }
.card > .card-sub { color: var(--violet-grise); font-size: 14px; margin: 0 0 24px; }

.section-rule {
  display: flex; align-items: center; gap: 14px;
  margin: 32px 0 20px;
}
.section-rule span {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--violet-grise); font-weight: 700; white-space: nowrap;
}
.section-rule::after { content: ''; height: 1px; background: var(--bordure); flex: 1; }

.hidden { display: none !important; }

/* Cartes formules */
.formules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 6px; }
.formule {
  position: relative;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 18px 16px;
  cursor: pointer;
  background: var(--blanc);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.formule:hover { border-color: var(--lavande); background: var(--lavande-voile); }
.formule input { position: absolute; opacity: 0; pointer-events: none; }
.formule.selected { border-color: var(--violet-profond); background: var(--lavande-voile); box-shadow: 0 0 0 3px rgba(198, 183, 216, .3); }
.formule .f-name { font-family: var(--serif); font-size: 16.5px; color: var(--violet-profond); display: block; margin-bottom: 6px; }
.formule .f-price { font-size: 22px; font-weight: 700; color: var(--violet-encre); }
.formule .f-price small { font-size: 13px; font-weight: 400; color: var(--violet-grise); }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 22px 24px;
  box-shadow: var(--ombre-douce);
}
.stat .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--violet-grise); font-weight: 700; }
.stat .v { font-family: var(--serif); font-size: 34px; color: var(--violet-profond); line-height: 1.2; margin-top: 6px; }

/* Mois */
.mois { border: 1px solid var(--bordure); border-radius: var(--rayon-sm); margin-bottom: 12px; overflow: hidden; background: var(--blanc); }
.mois-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: var(--lavande-voile);
  cursor: pointer;
}
.mois-head .m-nom { font-family: var(--serif); font-size: 17px; color: var(--violet-profond); margin-right: auto; }
.mois-head .m-count { font-size: 13px; color: var(--violet-grise); }
.mois-head .m-ca { font-weight: 700; color: var(--violet-profond); font-size: 14px; }
.mois.vide .mois-head { background: var(--blanc); opacity: .6; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th {
  text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--violet-grise); font-weight: 700; padding: 12px 20px; border-bottom: 1px solid var(--bordure);
}
td { padding: 13px 20px; border-bottom: 1px solid #F1EEF5; color: var(--texte); }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; white-space: nowrap; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--violet-grise);
  border: 1px dashed var(--bordure); border-radius: var(--rayon); background: var(--blanc);
}
.empty strong { display: block; font-family: var(--serif); font-size: 19px; color: var(--violet-profond); margin-bottom: 6px; font-weight: 500; }

/* ==========================================================================
   Messages
   ========================================================================== */

.alert {
  border-radius: var(--rayon-sm);
  padding: 13px 16px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-error { background: #FBF0F3; border-color: var(--rose-poudre); color: #8A4257; }
.alert-ok { background: #F0F4F1; border-color: var(--sauge); color: #4A5B4E; }
.alert-info { background: var(--lavande-voile); border-color: var(--lavande); color: var(--violet-profond); }

/* ==========================================================================
   Fenêtres modales
   ========================================================================== */

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(57, 47, 71, .38);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.modal {
  background: var(--blanc);
  border-radius: 20px;
  padding: 38px 36px 32px;
  max-width: 520px; width: 100%;
  box-shadow: 0 24px 60px rgba(57, 47, 71, .22);
  max-height: 90vh; overflow-y: auto;
  animation: monte .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes monte { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.modal h2 { font-size: 24px; margin-bottom: 8px; }
.modal p { color: var(--violet-grise); font-size: 14.5px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.modal-actions .btn { width: 100%; }

.choice {
  text-align: left;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 16px 18px;
  background: var(--blanc);
  cursor: pointer;
  font-family: var(--sans);
  width: 100%;
  transition: border-color .18s ease, background .18s ease;
}
.choice:hover:not(:disabled) { border-color: var(--lavande); background: var(--lavande-voile); }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.choice strong { display: block; color: var(--violet-profond); font-size: 15.5px; margin-bottom: 3px; }
.choice span { color: var(--violet-grise); font-size: 13.5px; line-height: 1.55; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* ==========================================================================
   Responsive & accessibilité
   ========================================================================== */

@media (max-width: 780px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .formules { grid-template-columns: 1fr; }
  .wrap { padding: 28px 18px 60px; }
  .card { padding: 22px 20px; }
  .page-head h1 { font-size: 26px; }
  .topbar-inner { padding: 14px 18px; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 9px 10px; font-size: 13.5px; }
  th, td { padding: 11px 14px; }
  .login-card { padding: 34px 24px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
