/* =====================================================
   Maison Bleue — système de design v2
   Palette douce et vivante, typographie moderne, composants soignés
   ===================================================== */

:root {
  --color-bg-gradient: radial-gradient(circle at 10% 0%, #f6f0ff 0%, transparent 45%),
                        radial-gradient(circle at 90% 10%, #e8f7f2 0%, transparent 40%),
                        radial-gradient(circle at 50% 100%, #fff2f6 0%, transparent 45%),
                        #f7f6fb;
  --color-surface: #ffffff;
  --color-surface-alt: #faf9ff;

  --color-primary: #7c6df2;
  --color-primary-dark: #6153d6;
  --color-primary-light: #ede9ff;
  --color-secondary: #ff8fab;
  --color-accent: #35c2a0;
  --color-accent-light: #e1f7f0;

  --color-text: #322e4a;
  --color-text-muted: #85809c;
  --color-border: #ece9f7;

  --color-danger: #f0625c;
  --color-danger-dark: #d6473f;
  --color-success: #35c2a0;
  --color-warning: #ffb454;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-soft: 0 6px 20px -4px rgba(90, 70, 160, 0.10);
  --shadow-hover: 0 14px 34px -8px rgba(90, 70, 160, 0.22);
  --shadow-btn: 0 6px 16px -4px rgba(124, 109, 242, 0.45);

  --font-heading: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }

/* ---------- Barre supérieure ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  transition: background .15s ease, color .15s ease;
}
.topbar nav a:hover { background: var(--color-primary-light); text-decoration: none; }
.topbar nav a.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.nav-toggle {
  display: none;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--color-text);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 72px;
}

/* ---------- Cartes ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.activity-card { border-top: 5px solid var(--activity-color, var(--color-primary)); }
.activity-card .titre { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.activity-card .meta { font-size: 0.87rem; color: var(--color-text-muted); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-light);
  color: #197a63;
}
.badge.pink { background: #ffe4ec; color: #a8305a; }
.badge.blue { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { box-shadow: 0 8px 22px -4px rgba(124,109,242,0.55); }
.btn-secondary { background: var(--color-surface-alt); color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); }
.btn-danger { background: linear-gradient(135deg, var(--color-danger), var(--color-danger-dark)); color: #fff; box-shadow: 0 6px 16px -4px rgba(240,98,92,0.45); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

/* Grand bouton "action" du tableau de bord */
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 18px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.action-btn .icon { font-size: 1.9rem; }
.action-btn:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  background: var(--color-primary-light);
}

/* ---------- Formulaires ---------- */
label { font-weight: 600; font-size: 0.85rem; color: var(--color-text); display: block; margin: 14px 0 6px; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-family: var(--font-body);
  font-size: 0.94rem;
  background: var(--color-surface-alt);
  color: var(--color-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}
textarea { resize: vertical; min-height: 90px; font-family: var(--font-body); }

/* Select façon menu déroulant moderne (flèche personnalisée) */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' stroke='%23857fa3' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}
select[multiple] { background-image: none; padding-right: 14px; }

input[type=color] {
  width: 52px; height: 42px; padding: 3px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border); background: var(--color-surface-alt); cursor: pointer;
}

.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 1.05rem; cursor: pointer; padding: 6px;
  line-height: 1; color: var(--color-text-muted);
}

/* Checkbox custom */
input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; vertical-align: middle;
}
.checkbox-line {
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.9rem;
  background: var(--color-surface-alt); border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-top: 8px; cursor: pointer;
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 180px; }
.form-hint { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 4px; }
fieldset { border: none; padding: 0; margin: 22px 0 0; }
legend { font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; color: var(--color-primary-dark); padding: 0 0 10px; width: 100%; border-bottom: 2px solid var(--color-primary-light); margin-bottom: 4px; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(50, 40, 80, 0.38);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn .15s ease; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px;
  box-shadow: var(--shadow-hover);
  position: relative;
  animation: popIn .18s ease;
}
.modal-close {
  position: absolute; top: 18px; right: 20px;
  background: var(--color-surface-alt); border: none; border-radius: 50%;
  width: 34px; height: 34px; font-size: 1.2rem; line-height: 1;
  cursor: pointer; color: var(--color-text-muted);
}
.modal-close:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Tableaux (admin) ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--color-surface); border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--color-border); }
th, td { text-align: left; padding: 13px 16px; font-size: 0.9rem; }
th { background: var(--color-surface-alt); font-family: var(--font-heading); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); }
td { border-top: 1px solid var(--color-border); }
tbody tr:hover td { background: var(--color-surface-alt); }

/* ---------- Toasts / messages flash ---------- */
.flash { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 600; font-size: 0.9rem; }
.flash.success { background: var(--color-accent-light); color: #197a63; }
.flash.error { background: #fdecea; color: #b8352c; }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 20px; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: 0.88rem; box-shadow: var(--shadow-hover); animation: slideIn .25s ease; }
.toast.success { background: var(--color-accent); }
.toast.error { background: var(--color-danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Planning public ---------- */
.view-switch { display: flex; justify-content: center; gap: 6px; margin: 20px 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-pill); padding: 5px; width: fit-content; margin-left: auto; margin-right: auto; }
.view-switch button { border: none; background: transparent; padding: 9px 20px; border-radius: var(--radius-pill); font-weight: 700; font-size: 0.88rem; cursor: pointer; color: var(--color-text-muted); }
.view-switch button.active { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: #fff; box-shadow: var(--shadow-btn); }

.calendar-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 22px 0; }
.calendar-nav .month-label { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; min-width: 220px; text-align: center; text-transform: capitalize; }

.planning-grid-wrap { overflow-x: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-soft); background: var(--color-surface); border: 1px solid var(--color-border); }
.planning-grid { width: 100%; border-collapse: collapse; min-width: 760px; border: none; border-radius: 0; }
.planning-grid th { background: var(--color-surface-alt); padding: 12px 6px; text-align: center; font-size: 0.78rem; text-transform: capitalize; border: none; }
.planning-grid td { border: 1px solid var(--color-border); vertical-align: top; padding: 4px; height: 54px; width: 14%; }
.planning-grid .hour-label { width: 56px; font-size: 0.76rem; color: var(--color-text-muted); text-align: right; padding-right: 8px; border: none; white-space: nowrap; }

/* Vue semaine : 7 colonnes empilant les événements du jour (pas de grille horaire) */
.week-columns { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.week-day-head {
  font-family: var(--font-heading); font-weight: 700; font-size: 0.82rem; text-transform: capitalize;
  color: var(--color-text-muted); text-align: center; padding-bottom: 10px; border-bottom: 2px solid var(--color-border); margin-bottom: 10px;
}
.week-day-head span { display: block; font-size: 0.74rem; font-weight: 600; color: var(--color-text-muted); opacity: .8; }
.week-day-empty { text-align: center; color: var(--color-text-muted); font-size: 0.85rem; padding: 14px 0; opacity: .5; }

.vacation-badge {
  background: var(--color-warning); color: #7a4a00; font-weight: 700; font-size: 0.74rem;
  border-radius: var(--radius-pill); padding: 5px 10px; text-align: center; margin-bottom: 8px;
}
.month-cell.is-vacation { background: #fff8ec; border-color: #ffe2b0; }
.week-event-card {
  background: var(--color-surface); border-left: 5px solid var(--activity-color, var(--color-primary));
  border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); padding: 10px 12px; margin-bottom: 10px;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.week-event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.week-event-card .heure { font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem; color: var(--color-primary-dark); line-height: 1; }
.week-event-card .titre { font-size: 0.86rem; font-weight: 600; color: var(--color-text); margin-top: 4px; }

@media (max-width: 800px) {
  .week-columns { grid-template-columns: repeat(7, minmax(110px, 1fr)); }
}
@media (max-width: 640px) {
  .week-columns { display: flex; flex-direction: column; }
}

.event-chip { background: var(--chip-color, var(--color-primary)); color: #fff; border-radius: 8px; padding: 4px 8px; font-size: 0.74rem; margin-bottom: 3px; cursor: pointer; line-height: 1.25; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: filter .1s ease; }
.event-chip:hover { filter: brightness(0.92); }
.event-chip .t { font-weight: 700; display:block; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-grid .month-day-head { text-align: center; font-weight: 700; font-size: 0.78rem; color: var(--color-text-muted); text-transform: capitalize; }
.month-grid .month-cell { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); min-height: 90px; padding: 7px; box-shadow: var(--shadow-soft); }
.month-grid .month-cell .day-num { font-weight: 700; font-size: 0.8rem; color: var(--color-text-muted); }
.month-grid .month-cell.out { opacity: 0.35; }

.day-group { margin-bottom: 28px; }
.day-group h3 { text-transform: capitalize; color: var(--color-primary-dark); border-bottom: 2px solid var(--color-border); padding-bottom: 6px; }

.empty-state { text-align: center; color: var(--color-text-muted); padding: 50px 20px; font-size: 0.95rem; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card .logo { font-size: 2.4rem; margin-bottom: 6px; }

/* ---------- Dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 34px; }
.stat-card { text-align: center; }
.stat-card .value { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; color: var(--color-primary-dark); }
.stat-card .label { color: var(--color-text-muted); font-size: 0.82rem; margin-top: 2px; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; margin-top: 20px; }

/* ---------- Accordéon activités ---------- */
.accordion-item { margin-bottom: 14px; }
.accordion-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; cursor: pointer; }
.accordion-head .chevron { transition: transform .2s ease; color: var(--color-text-muted); font-size: 1.1rem; }
.accordion-item.open > .accordion-head .chevron { transform: rotate(180deg); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.accordion-item.open > .accordion-body { max-height: 4000px; }
.accordion-body-inner { padding-top: 16px; }

@media (max-width: 640px) {
  .topbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .topbar nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    order: 3;
    margin-top: 10px;
  }
  .topbar nav.open { display: flex; }
  .topbar nav a { width: 100%; }
  .page { padding: 22px 16px 56px; }
}
