/* PêcheRéserv — Design System */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
  --bois:   #2C1A0E;
  --eau:    #1B4F72;
  --aube:   #E8D5A3;
  --mousse: #4A7C59;
  --jour:   #F4C842;
  --accent: #D4692A;
  --brume:  #F5F0E8;
  --blanc:  #FEFCF7;
  --rouge:  #C0392B;
  --gris:   #666;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(44,26,14,.10);
}

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

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(14px, 1.5vw, 16px);
  background: var(--brume);
  color: var(--bois);
  min-height: 100vh;
}

/* ──────────────── HEADER ──────────────── */
#app-header {
  background: var(--bois);
  color: var(--aube);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
#app-header .logo {
  font-family: 'Playfair Display', serif;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 900;
  color: var(--aube);
  text-decoration: none;
  white-space: nowrap;
}
#app-header nav { display: flex; gap: .25rem; flex: 1; }
#app-header nav a {
  color: var(--aube);
  text-decoration: none;
  padding: .45rem .8rem;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 600;
  opacity: .75;
  transition: opacity .15s, background .15s;
}
#app-header nav a:hover, #app-header nav a.active { opacity: 1; background: rgba(232,213,163,.15); }
#app-header .user-info {
  font-size: .82rem;
  opacity: .8;
  white-space: nowrap;
}
#app-header .btn-logout {
  background: rgba(232,213,163,.15);
  border: 1px solid rgba(232,213,163,.3);
  color: var(--aube);
  padding: .35rem .8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}
#app-header .btn-logout:hover { background: rgba(232,213,163,.3); }

/* Progress bar */
#progress-bar {
  position: fixed; top: 58px; left: 0; height: 3px;
  background: var(--jour); width: 0; z-index: 200;
  transition: width .3s ease, opacity .3s;
}

/* ──────────────── LAYOUT ──────────────── */
main { max-width: 1300px; margin: 0 auto; padding: 1.5rem; }

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  color: var(--bois);
  margin-bottom: 1.25rem;
}

/* Grille 2 colonnes */
.layout-split { display: grid; grid-template-columns: 340px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .layout-split { grid-template-columns: 1fr; } }

/* ──────────────── CARDS ──────────────── */
.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bois);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--aube);
}

/* Stats dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--eau);
}
.stat-card .stat-val { font-size: 2rem; font-weight: 700; color: var(--eau); line-height: 1; }
.stat-card .stat-lbl { font-size: .8rem; color: var(--gris); margin-top: .25rem; }

/* ──────────────── TABLEAUX ──────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--blanc); }
thead tr { background: var(--bois); color: var(--aube); }
th { padding: .75rem 1rem; text-align: left; font-size: .82rem; font-weight: 600; letter-spacing: .03em; }
td { padding: .65rem 1rem; border-bottom: 1px solid #EDE9DF; font-size: .9rem; }
tbody tr:hover { background: #FAF7F2; }
tbody tr:last-child td { border-bottom: none; }

/* ──────────────── FORMULAIRES ──────────────── */
.form-group { margin-bottom: .9rem; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--bois); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1.5px solid #D5CEC4;
  border-radius: 7px;
  font-family: inherit;
  font-size: .9rem;
  background: var(--blanc);
  color: var(--bois);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--eau);
  box-shadow: 0 0 0 3px rgba(27,79,114,.12);
}
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

/* ──────────────── BOUTONS ──────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem;
  border: none; border-radius: 7px;
  font-family: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary   { background: var(--bois); color: var(--aube); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(44,26,14,.25); }
.btn-secondary { background: transparent; border: 1.5px solid var(--bois); color: var(--bois); }
.btn-secondary:hover { background: rgba(44,26,14,.05); }
.btn-danger    { background: var(--rouge); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-edit      { background: var(--eau); color: #fff; }
.btn-edit:hover { opacity: .85; }
.btn-sm        { padding: .3rem .7rem; font-size: .78rem; }
.btn-full      { width: 100%; justify-content: center; }

/* ──────────────── BADGES ──────────────── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-jour   { background: #FEF9E7; color: #B7950B; border: 1px solid #F4C842; }
.badge-soir   { background: #F3E8FF; color: #6C3483; border: 1px solid #C39BD3; }
.badge-libre  { background: #EAFAF1; color: #1E8449; border: 1px solid #82E0AA; }
.badge-occupe { background: #FDEDEC; color: var(--rouge); border: 1px solid #F1948A; }
.badge-admin  { background: var(--bois); color: var(--aube); }
.badge-user   { background: var(--eau); color: #fff; }
.badge-actif  { background: #EAFAF1; color: #1E8449; }
.badge-inactif{ background: #F2F3F4; color: #717D7E; }

/* ──────────────── SEARCH BAR ──────────────── */
.search-bar {
  display: flex; gap: .75rem; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.search-bar input  { max-width: 280px; flex: 1; }
.search-bar select { max-width: 180px; }

/* ──────────────── TABS ──────────────── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--aube); }
.tab-btn {
  padding: .6rem 1.2rem; border: none; background: none;
  font-family: inherit; font-size: .9rem; font-weight: 600;
  color: var(--gris); cursor: pointer; border-radius: 7px 7px 0 0;
  transition: color .15s, background .15s;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab-btn.active { color: var(--bois); border-bottom-color: var(--bois); }
.tab-btn:hover  { color: var(--bois); background: rgba(44,26,14,.04); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* ──────────────── CALENDRIER STRIP ──────────────── */
.cal-strip {
  display: flex; gap: .35rem; overflow-x: auto;
  padding-bottom: .5rem; margin-bottom: 1rem;
}
.cal-day {
  min-width: 52px; padding: .5rem .4rem;
  background: var(--blanc); border: 1.5px solid #E0D8CC;
  border-radius: 8px; text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cal-day:hover { border-color: var(--eau); }
.cal-day.selected { background: var(--bois); border-color: var(--bois); color: var(--aube); }
.cal-day .cal-dow { font-size: .68rem; font-weight: 600; text-transform: uppercase; opacity: .7; }
.cal-day .cal-num { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.cal-day.selected .cal-dow { color: var(--aube); opacity: .7; }

/* ──────────────── TIMELINE ──────────────── */
.timeline { display: flex; flex-direction: column; gap: .6rem; }
.timeline-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem;
  background: var(--blanc); border-radius: 8px;
  border-left: 4px solid var(--aube);
  box-shadow: var(--shadow);
}
.timeline-item.jour { border-left-color: var(--jour); }
.timeline-item.soir { border-left-color: #9B59B6; }
.timeline-time { font-size: .75rem; color: var(--gris); min-width: 60px; }
.timeline-body { flex: 1; }
.timeline-client { font-weight: 600; font-size: .9rem; }
.timeline-meta   { font-size: .78rem; color: var(--gris); }

/* ──────────────── DISPONIBILITÉ ──────────────── */
.dispo-badge {
  display: inline-block; padding: .18rem .5rem; border-radius: 5px;
  font-size: .72rem; font-weight: 600;
}
.dispo-libre  { background: #EAFAF1; color: #1E8449; }
.dispo-occupe { background: #FDEDEC; color: var(--rouge); }

/* Indicator de disponibilité dans le formulaire */
#dispo-indicator {
  font-size: .82rem; font-weight: 600; padding: .35rem .75rem;
  border-radius: 6px; display: inline-block;
}
#dispo-indicator.libre  { background: #EAFAF1; color: #1E8449; }
#dispo-indicator.occupe { background: #FDEDEC; color: var(--rouge); }

/* ──────────────── MESSAGES ──────────────── */
.alert {
  padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem;
}
.alert-success { background: #EAFAF1; color: #1E8449; border-left: 4px solid #27AE60; }
.alert-error   { background: #FDEDEC; color: var(--rouge); border-left: 4px solid var(--rouge); }

.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: .8rem 1.25rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  z-index: 9000; animation: slideIn .25s ease;
  max-width: 360px;
}
.toast-success { background: #27AE60; color: #fff; }
.toast-error   { background: var(--rouge); color: #fff; }
@keyframes slideIn { from { transform: translateY(20px); opacity:0; } to { transform: none; opacity:1; } }

/* ──────────────── MODAL ──────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--blanc); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  padding: 1.75rem; max-width: 480px; width: 100%;
}
.modal h3 { font-family: 'Playfair Display', serif; margin-bottom: .75rem; }
.modal-actions { display: flex; gap: .75rem; margin-top: 1.25rem; justify-content: flex-end; }

/* ──────────────── LOGIN PAGE ──────────────── */
body.login-page {
  display: flex; align-items: center; justify-content: center;
  background: var(--bois); min-height: 100vh;
}
.login-box {
  background: var(--blanc); border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,.35);
  padding: 2.5rem 2rem; width: 100%; max-width: 380px;
}
.login-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem; font-weight: 900; color: var(--bois);
  text-align: center; margin-bottom: .25rem;
}
.login-sub { text-align: center; color: var(--gris); font-size: .85rem; margin-bottom: 1.75rem; }

/* ──────────────── RESPONSIVE ──────────────── */
@media (max-width: 768px) {
  #app-header { flex-wrap: wrap; height: auto; padding: .6rem 1rem; gap: .5rem; }
  #app-header nav { width: 100%; overflow-x: auto; }
  main { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tab-btn { padding: .5rem .7rem; font-size: .8rem; }
}

/* Chalet cards grid */
.chalets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.chalet-card {
  background: var(--blanc); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.25rem;
  border-top: 4px solid var(--bois);
}
.chalet-card-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem; font-weight: 900; color: var(--bois); line-height: 1;
}
.chalet-card-meta { font-size: .8rem; color: var(--gris); margin: .25rem 0 .6rem; }
.chalet-card-tarifs { display: flex; gap: .5rem; margin: .5rem 0; }
.chalet-card-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

/* Impersonation banner */
#impersonate-banner {
  background: var(--accent); color: #fff;
  text-align: center; padding: .45rem 1rem;
  font-size: .85rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
}
#impersonate-banner button {
  background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.5);
  color: #fff; padding: .2rem .75rem; border-radius: 5px; cursor: pointer; font-weight: 600;
}

/* Spinner */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 3px solid rgba(44,26,14,.15);
  border-top-color: var(--bois); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--gris);
}
.empty-state p { font-size: 1rem; margin-top: .5rem; }
