/* ═══════════════════════════════════════════
   StudioPro — Design System
   Primary: #C9A84C  |  BG: #0D0D0D
   ═══════════════════════════════════════════ */

:root {
  --primary:     #C9A84C;
  --primary-2:   #8B6914;
  --accent-grad: linear-gradient(135deg, #C9A84C, #8B6914);
  --bg-app:      #0D0D0D;
  --bg-sidebar:  #1A1A1A;
  --bg-card:     #1E1E1E;
  --bg-card-2:   #252525;
  --text-main:   #F5F0E8;
  --text-muted:  #888;
  --border:      rgba(201, 168, 76, 0.18);
  --sidebar-w:   250px;
  --topbar-h:    56px;
  --radius-btn:  12px;
  --radius-card: 18px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}
[dir="rtl"] body { font-family: 'Cairo', 'Segoe UI', sans-serif; }
[dir="ltr"] body { font-family: 'Inter', 'Segoe UI', sans-serif; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: #e0be6a; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
[dir="ltr"] .sidebar { left: 0; }
[dir="rtl"] .sidebar { right: 0; border-right: none; border-left: 1px solid var(--border); }

.sidebar.collapsed {
  transform: translateX(-100%);
}
[dir="rtl"] .sidebar.collapsed {
  transform: translateX(100%);
}

.sidebar-brand {
  padding: 20px 18px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all .2s;
  white-space: nowrap;
}
.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
}
.sidebar-nav .nav-link:hover {
  background: rgba(201, 168, 76, 0.1);
  color: var(--primary);
}
.sidebar-nav .nav-link.active {
  background: var(--accent-grad);
  color: #fff;
  font-weight: 600;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.logout-link {
  color: #e74c3c !important;
}
.logout-link:hover {
  background: rgba(231, 76, 60, 0.1) !important;
  color: #e74c3c !important;
}

/* ── Main Wrapper ── */
.main-wrapper {
  transition: margin .25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[dir="ltr"] .main-wrapper { margin-left: var(--sidebar-w); }
[dir="rtl"] .main-wrapper { margin-right: var(--sidebar-w); }
.main-wrapper.expanded {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 900;
  gap: 12px;
}
.topbar-right {
  margin-left: auto;
}
[dir="rtl"] .topbar-right { margin-left: 0; margin-right: auto; }

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

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

/* ── Flash ── */
.flash-container {
  padding: 0 24px;
}
.alert-sp {
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
}

/* ── Buttons ── */
.btn-gold {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-weight: 600;
  transition: opacity .2s, transform .1s;
}
.btn-gold:hover { opacity: .88; color: #fff; transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }

.btn-outline-gold {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
  border-radius: var(--radius-btn);
  transition: all .2s;
}
.btn-outline-gold:hover {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
}

.btn-xs {
  padding: 3px 9px;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ── Cards ── */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.card-dark-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}
.card-dark-body {
  padding: 18px;
}

/* ── KPI Cards ── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.bg-gold   { background: var(--accent-grad); }
.bg-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.bg-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.bg-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }

.kpi-value { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.kpi-value small { font-size: 0.65rem; font-weight: 400; color: var(--text-muted); }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.kpi-mini  { font-size: 0.9rem; }

/* ── Tables ── */
.table-sp {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table-sp thead th {
  background: var(--bg-card-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.table-sp tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.table-sp tbody tr:hover { background: rgba(201,168,76,0.04); }

/* ── Status Badges ── */
.badge-statut {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-en_attente  { background: rgba(249,115,22,.15); color: #f97316; }
.badge-confirmee   { background: rgba(59,130,246,.15);  color: #3b82f6; }
.badge-en_retouche { background: rgba(139,92,246,.15);  color: #8b5cf6; }
.badge-livree      { background: rgba(34,197,94,.15);   color: #22c55e; }
.badge-annulee     { background: rgba(239,68,68,.15);   color: #ef4444; }

.statut-select {
  background: var(--bg-card-2);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  padding: 4px 8px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-bar .form-control,
.filter-bar .form-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 10px;
  font-size: 0.85rem;
}
.filter-bar .form-control::placeholder { color: var(--text-muted); }
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(201,168,76,.2);
}

/* ── Form Controls ── */
.form-control, .form-select {
  background: var(--bg-card-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-main) !important;
  border-radius: 10px !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(201,168,76,.2) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 4px; }
input[list] { color-scheme: light; }

.form-select option { background: #1e1e1e; }

/* ── Modal ── */
.modal-dark {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  color: var(--text-main);
}
.modal-dark .modal-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.modal-dark .modal-footer {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
}
.modal-dark .modal-body { padding: 18px; }

/* ── Session items (dashboard) ── */
.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.session-item:last-child { border-bottom: none; }
.session-time { font-size: 0.8rem; color: var(--primary); font-weight: 600; min-width: 70px; }
.session-info { flex: 1; }
.session-info strong { display: block; font-size: 0.9rem; }
.session-info span { font-size: 0.78rem; color: var(--text-muted); }

/* ── Period bar (stats) ── */
.period-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ── Auth Pages ── */
.auth-page {
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 36px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-brand i {
  font-size: 2.5rem;
  color: var(--primary);
  display: block;
  margin-bottom: 8px;
}
.auth-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.auth-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}
.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.lang-switch-auth {
  text-align: center;
  margin-top: 12px;
  font-size: 0.8rem;
}
.lang-switch-auth a { color: var(--text-muted); }
.lang-switch-auth a.active { color: var(--primary); font-weight: 600; }

/* ── Input group ── */
.input-group-text {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--primary);
}

/* ── Language switch ── */
.lang-switch {
  display: flex;
  gap: 4px;
}
.lang-switch .btn { font-size: 0.78rem; padding: 3px 8px; border-radius: 8px; font-weight: 600; }

/* ── Text colors ── */
.text-gold { color: var(--primary) !important; }

/* ── Avatar ── */
.avatar-circle {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Badge category ── */
.badge-cat {
  background: rgba(201,168,76,.15);
  color: var(--primary);
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── Nav tabs (parametre_facture) ── */
.nav-tabs-sp {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.nav-tabs-sp li { margin: 0; }
.nav-tabs-sp a {
  display: block;
  padding: 8px 14px;
  border-radius: 10px 10px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all .2s;
  cursor: pointer;
}
.nav-tabs-sp a:hover { color: var(--primary); background: rgba(201,168,76,.08); }
.nav-tabs-sp a.active { background: var(--accent-grad); color: #fff; font-weight: 600; }

.tab-pane-sp { display: none; }
.tab-pane-sp.active { display: block; }

/* ── Client: Service cards ── */
.service-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.service-card:hover { border-color: var(--primary); }
.service-card.selected {
  border-color: var(--primary);
  background: rgba(201,168,76,.1);
}
.service-img { width: 100%; height: 100px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.service-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 8px; }
.service-name { font-weight: 600; font-size: 0.9rem; }

/* ── Forfait cards ── */
.forfait-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 14px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.forfait-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.forfait-card.selected {
  border-color: var(--primary);
  background: rgba(201,168,76,.1);
}
.forfait-name { font-weight: 700; margin-bottom: 6px; }
.forfait-prix { font-size: 1.1rem; font-weight: 700; }
.forfait-duree { margin-top: 4px; }

/* ── Step number ── */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--accent-grad);
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 6px;
  margin-right: 6px;
}

/* ── Invoice (client page) ── */
.invoice-client-box {
  background: var(--bg-card-2);
  border-radius: 12px;
  padding: 14px 16px;
}
.invoice-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.9rem;
}
.total-final {
  border-top: 2px solid var(--primary);
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 700;
}
.invoice-footer-text {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.facture-mini {
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ── Star rating (client avis) ── */
.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}
.star-rating input { display: none; }
.star-rating label {
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s;
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--primary);
}

/* ── Notifications dropdown ── */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff;
  border-radius: 50%; min-width: 18px; height: 18px;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
[dir="rtl"] .notif-badge { right: auto; left: -4px; }

.notif-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 340px;
  max-width: 380px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 12px 40px -10px rgba(0,0,0,0.6);
}
.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex; gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none; color: var(--text-main);
}
.notif-item:hover { background: rgba(201,168,76,0.08); }
.notif-item.unread { background: rgba(201,168,76,0.05); }
.notif-item.unread::before {
  content: ""; width: 8px; height: 8px;
  background: var(--primary); border-radius: 50%;
  flex-shrink: 0; margin-top: 6px;
}
.notif-icon {
  width: 32px; height: 32px;
  background: rgba(201,168,76,0.15);
  border-radius: 50%; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 2px; }
.notif-text  { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.notif-time  { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* ── Impersonation banner ── */
.impersonation-banner {
  background: linear-gradient(90deg, #7c3aed, #4c1d95);
  color: #fff;
  padding: 10px 20px;
  text-align: center;
  font-size: 0.88rem;
  border-bottom: 2px solid #5b21b6;
  position: sticky;
  top: 0;
  z-index: 1010;
}
.impersonation-banner a.btn-light {
  color: #4c1d95;
  font-weight: 600;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; }
  [dir="ltr"] .main-wrapper { margin-left: 0 !important; }
  [dir="rtl"] .main-wrapper { margin-right: 0 !important; }
  .page-content { padding: 14px; }
  .kpi-card { padding: 12px; }
}
