/* ── Variables (reprend la palette de style.css) ───────────────────────────── */
:root {
  --forest:      #1f5f43;
  --forest-dark: #143f31;
  --paper:       #fffdf7;
  --ink:         #1c2520;
  --muted:       #69746d;
  --line:        rgba(31, 95, 67, 0.16);
  --radius-card: 16px;
  --shadow-card: 0 8px 32px rgba(20, 36, 28, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #eef3ee;
}

#app { min-height: 100vh; }

/* ── Page générique ─────────────────────────────────────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.page--loading {
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Boutons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms, transform 80ms, box-shadow 140ms;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.97); }

.btn--primary {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 4px 14px rgba(31, 95, 67, 0.25);
}
.btn--primary:not(:disabled):hover { background: var(--forest-dark); }

.btn--ghost {
  background: rgba(31, 95, 67, 0.07);
  color: var(--forest-dark);
  border: 1px solid var(--line);
}
.btn--ghost:not(:disabled):hover { background: rgba(31, 95, 67, 0.14); }

.btn--danger {
  background: #c0392b;
  color: #fff;
}
.btn--danger:not(:disabled):hover { background: #a93226; }

.btn--full   { width: 100%; }
.btn--lg     { padding: 13px 28px; font-size: 1rem; border-radius: 12px; }
.btn--sm     { padding: 6px 14px;  font-size: 0.82rem; }
.btn--icon   { padding: 8px 12px; }

/* ── Alertes ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.alert[hidden] { display: none; }
.alert--error   { background: rgba(192, 57, 43, 0.1); color: #c0392b; border: 1px solid rgba(192,57,43,0.2); }
.alert--success { background: rgba(31, 95, 67, 0.1);  color: var(--forest-dark); border: 1px solid var(--line); }

/* ── Formulaires ─────────────────────────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field__label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--forest-dark);
}

.form-field__input {
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 140ms, box-shadow 140ms;
  width: 100%;
}
.form-field__input:focus {
  outline: none;
  border-color: rgba(31, 95, 67, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 95, 67, 0.1);
}

.form-field__textarea { resize: vertical; min-height: 70px; }

.form-field__pw-wrap { position: relative; }
.form-field__pw-wrap .form-field__input { padding-right: 44px; }

.btn-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
}

.form-field__error {
  font-size: 0.78rem;
  color: #c0392b;
  min-height: 1em;
}

/* ── HomePage ─────────────────────────────────────────────────────────────────── */
.home-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 60px;
  background: linear-gradient(160deg, #1a3d28 0%, #2f6f43 50%, #1a4060 100%);
}

.home-hero__content {
  max-width: 520px;
  text-align: center;
  color: #fff;
}

.home-hero__badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.home-hero__title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  margin: 0 0 16px;
}

.home-hero__sub {
  font-size: 1.05rem;
  opacity: 0.85;
  line-height: 1.55;
  margin: 0 0 32px;
}

.home-hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 48px 24px;
  background: var(--paper);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.feature-card {
  padding: 24px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  text-align: center;
}

.feature-card__icon { font-size: 2rem; display: block; margin-bottom: 12px; }
.feature-card h3    { margin: 0 0 8px; font-size: 1rem; color: var(--forest-dark); }
.feature-card p     { margin: 0; font-size: 0.86rem; color: var(--muted); line-height: 1.5; }

/* ── Auth card ────────────────────────────────────────────────────────────────── */
.page--auth {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #eef3ee 0%, #dde8dd 100%);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-back {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 4px;
}
.auth-back:hover { color: var(--forest); }

.auth-card__title { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--forest-dark); }
.auth-card__sub   { margin: 0; font-size: 0.88rem; color: var(--muted); }

.auth-form  { display: flex; flex-direction: column; gap: 16px; }

.auth-card__footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.auth-link {
  color: var(--forest);
  font-weight: 700;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* ── Modales ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--paper);
  border-radius: var(--radius-card);
  padding: 28px 24px 24px;
  width: min(460px, 100%);
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal--sm { max-width: 360px; }

.modal__title  { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--forest-dark); }
.modal__body   { margin: 0; font-size: 0.9rem; color: var(--muted); line-height: 1.5; }
.modal__form   { display: flex; flex-direction: column; gap: 14px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ── Skeleton shimmer ────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sk-shimmer {
  background: linear-gradient(90deg, #e8ede8 25%, #d8e0d8 50%, #e8ede8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.sk-line {
  height: 10px;
  border-radius: 5px;
  margin-bottom: 8px;
}
.sk-line--40 { width: 40%; }
.sk-line--60 { width: 60%; }
.sk-line--80 { width: 80%; }

.sk-line {
  background: linear-gradient(90deg, #e8ede8 25%, #d8e0d8 50%, #e8ede8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Dark mode ───────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #14201a;
    --ink:     #d4e8d8;
    --muted:   #7a9a8a;
    --line:    rgba(78, 168, 118, 0.15);
  }
  body { background: #0e1610; }
  .auth-card, .modal  { background: #1a2620; }
  .feature-card       { background: #1a2620; }
  .form-field__input  { background: #111c14; border-color: rgba(78,168,118,0.2); color: var(--ink); }
  .home-features      { background: #0e1610; }
  .sk-shimmer, .sk-line {
    background: linear-gradient(90deg, #1e2e22 25%, #243428 50%, #1e2e22 75%);
    background-size: 200% 100%;
  }
}

/* ── Page profil ──────────────────────────────────────────────────────────────── */

.page--profile {
  min-height: 100vh;
  background: #f4f1ea;
  display: flex;
  flex-direction: column;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.profile-header__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--forest-dark);
}

.profile-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 40px 24px;
}

.profile-card {
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(22, 35, 29, 0.10);
  padding: 36px 32px;
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-avatar {
  display: flex;
  justify-content: center;
}

.profile-avatar__img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--line);
}

.profile-avatar__initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.profile-signout {
  display: flex;
  justify-content: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.btn--danger-ghost {
  color: #c0392b;
  font-size: 0.9rem;
}

.btn--danger-ghost:hover { background: rgba(192, 57, 43, 0.07); }

.auth-card__forgot {
  margin: 0;
  text-align: right;
  font-size: 0.85rem;
}

.alert--success {
  background: #e6f4ec;
  color: #1a5c32;
  border: 1px solid #b2dcc4;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}
