/* ═══════════════════════════════════════════════════
   MELLIBER RH — Refined Dark Hospitality UI
   Fonts: Playfair Display + DM Sans
   Palette: Deep Navy · Gold · Warm White
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:        #08090d;
  --bg2:       #0e1018;
  --bg3:       #141720;
  --surface:   #1a1e2c;
  --surface2:  #202538;
  --border:    #252a3a;
  --border2:   #2e3550;
  --text:      #e8eaf2;
  --text2:     #8a91aa;
  --text3:     #4a5070;
  --gold:      #c9a84c;
  --gold2:     #e8c46a;
  --gold-dim:  rgba(201,168,76,.12);
  --green:     #3dba7e;
  --red:       #e05555;
  --orange:    #e8854a;
  --blue:      #4a8fff;
  --purple:    #8b6fff;
  --sidebar-w: 260px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 8px 32px rgba(0,0,0,.5);
  --font-head: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --trans:     .18s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--trans);
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar Brand ───────────────────────────────── */
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.brand-monogram {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(201,168,76,.3);
}

.brand-name {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sidebar-week-badge {
  margin-top: 14px;
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,.25);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: .04em;
}

.sidebar-week-badge span {
  display: block;
  color: var(--text2);
  font-weight: 400;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0;
}

/* ── Sidebar Nav ─────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 8px 12px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--trans);
  position: relative;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 18px; height: 18px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-badge.gold {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,.3);
}

/* ── Sidebar Footer ──────────────────────────────── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2e3550, #3a4268);
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: 10px;
  color: var(--text3);
}

/* ── Top Bar ─────────────────────────────────────── */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid var(--border2);
  transition: var(--trans);
  text-decoration: none;
  background: transparent;
  color: var(--text2);
}

.btn-topbar svg { width: 15px; height: 15px; fill: currentColor; }
.btn-topbar:hover { background: var(--surface); color: var(--text); }

.btn-topbar.gold {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  font-weight: 700;
}
.btn-topbar.gold:hover { background: var(--gold2); }

/* ── Page Content ────────────────────────────────── */
.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* ── KPI Cards ───────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--trans), transform var(--trans);
  cursor: default;
}

.kpi-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-color, var(--gold));
  opacity: .8;
}

.kpi-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 16px;
}

.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 6px;
  font-weight: 600;
}

.kpi-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.kpi-value.gold   { color: var(--gold); }
.kpi-value.green  { color: var(--green); }
.kpi-value.red    { color: var(--red); }
.kpi-value.orange { color: var(--orange); }
.kpi-value.blue   { color: var(--blue); }

.kpi-trend {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
}

/* ── Panel / Card ────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.panel-body { padding: 20px; }

/* ── Planning Table ──────────────────────────────── */
.planning-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.planning-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 900px;
}

.planning-table thead th {
  padding: 10px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.planning-table thead th.day-col {
  text-align: center;
  min-width: 60px;
}

.planning-table thead th.day-col.weekend {
  background: rgba(139,111,255,.08);
  color: var(--purple);
}

.planning-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}

.planning-table tbody tr:hover { background: var(--bg3); }
.planning-table tbody tr:last-child { border-bottom: none; }

.planning-table tbody td {
  padding: 9px 10px;
  vertical-align: middle;
}

/* Service separator rows */
.svc-separator td {
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  border-top: 2px solid var(--border);
}

/* Employee name */
.emp-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.emp-pos {
  font-size: 10.5px;
  color: var(--text3);
}

/* Horaire select */
.horaire-select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 8px;
  width: 100%;
  min-width: 120px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a5070'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.horaire-select:focus { border-color: var(--gold); }
.horaire-select.filled { border-color: rgba(201,168,76,.4); background-color: rgba(201,168,76,.06); color: var(--gold); }

/* Day cells */
.day-cell {
  text-align: center;
  position: relative;
}

.day-cell.weekend { background: rgba(139,111,255,.04); }

.off-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
}

.off-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1.5px solid var(--border2);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  transition: var(--trans);
  display: flex; align-items: center; justify-content: center;
}

.off-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(224,85,85,.1);
}

.off-btn.active {
  background: rgba(224,85,85,.15);
  border-color: var(--red);
  color: var(--red);
  font-weight: 900;
}

.off-btn.conge {
  background: rgba(74,143,255,.1);
  border-color: var(--blue);
  color: var(--blue);
}

/* Conge select */
.conge-select {
  background: rgba(74,143,255,.08);
  border: 1px solid rgba(74,143,255,.25);
  border-radius: 6px;
  color: var(--blue);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 5px 8px;
  width: 100%;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans);
}

/* Observations input */
.obs-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 11.5px;
  padding: 5px 8px;
  width: 100%;
  transition: border-color var(--trans);
  outline: none;
}

.obs-input:hover { border-color: var(--border2); }
.obs-input:focus { border-color: var(--gold); background: var(--bg3); }

/* ── Filters Bar ─────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-select, .filter-input {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--trans);
}

.filter-select:focus, .filter-input:focus { border-color: var(--gold); }

.filter-input { min-width: 200px; }
.filter-input::placeholder { color: var(--text3); }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.badge-green  { background: rgba(61,186,126,.12); color: var(--green); border: 1px solid rgba(61,186,126,.25); }
.badge-red    { background: rgba(224,85,85,.12);  color: var(--red);   border: 1px solid rgba(224,85,85,.25); }
.badge-orange { background: rgba(232,133,74,.12); color: var(--orange);border: 1px solid rgba(232,133,74,.25); }
.badge-blue   { background: rgba(74,143,255,.12); color: var(--blue);  border: 1px solid rgba(74,143,255,.25); }
.badge-gold   { background: var(--gold-dim);       color: var(--gold); border: 1px solid rgba(201,168,76,.25); }
.badge-purple { background: rgba(139,111,255,.12); color: var(--purple);border: 1px solid rgba(139,111,255,.25);}
.badge-grey   { background: rgba(74,80,112,.2);   color: var(--text3); border: 1px solid var(--border); }

/* ── Progress Bar ────────────────────────────────── */
.progress-wrap { height: 4px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--gold); transition: width .5s ease; }
.progress-fill.green  { background: var(--green); }
.progress-fill.red    { background: var(--red); }
.progress-fill.orange { background: var(--orange); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  transition: var(--trans);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn-sm { padding: 6px 12px; font-size: 11.5px; }

.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold2); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger { background: rgba(224,85,85,.12); color: var(--red); border: 1px solid rgba(224,85,85,.25); }
.btn-danger:hover { background: rgba(224,85,85,.22); }

/* ── Signature Zone ──────────────────────────────── */
.signature-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}

.sig-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.sig-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 6px;
}

.sig-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--trans);
}

.sig-input:focus { border-color: var(--gold); }

.sig-box {
  min-height: 80px;
  background: var(--bg3);
  border: 1px dashed var(--border2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--trans);
}

.sig-box:hover { border-color: var(--gold); }

/* ── Legend ──────────────────────────────────────── */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
}

/* ── Toast notifications ─────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--gold); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Stats Cards per service ─────────────────────── */
.svc-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.svc-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.svc-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.svc-name { font-size: 12.5px; color: var(--text2); width: 160px; flex-shrink: 0; }
.svc-bar  { flex: 1; }
.svc-pct  { font-size: 12px; color: var(--text3); width: 36px; text-align: right; flex-shrink: 0; }

/* ── Hamburger (mobile) ──────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text2);
}

/* ── Animations ──────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel, .kpi-card { animation: fadeUp .22s ease both; }
.kpi-card:nth-child(2) { animation-delay: .04s; }
.kpi-card:nth-child(3) { animation-delay: .08s; }
.kpi-card:nth-child(4) { animation-delay: .12s; }
.kpi-card:nth-child(5) { animation-delay: .16s; }
.kpi-card:nth-child(6) { animation-delay: .20s; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 992px) {
  :root { --sidebar-w: 0px; }

  .app-sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main { margin-left: 0; }

  .hamburger { display: flex; }

  .page-content { padding: 16px; }

  .sig-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 16px; }
}

/* ── Overlay (mobile sidebar) ────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
}

.sidebar-overlay.show { display: block; }
