/* ============================================
   BàO Digital — Admin Panel Styles
   ============================================ */
:root {
  --vert: #4A3F91;
  --vert-clair: #E7E4F2;
  --vert-fonce: #2E2760;
  --orange: #f07b23;
  --orange-clair: #fff7ed;
  --ivoire: #fafaf7;
  --noir: #111;
  --gris: #6b7280;
  --gris-clair: #f3f4f6;
  --gris-moyen: #9ca3af;
  --danger: #ef4444;
  --danger-clair: #fef2f2;
  --warning: #f59e0b;
  --info: #3b82f6;
  --info-clair: #eff6ff;
  --success: #22c55e;
  --success-clair: #f0fdf4;
  --whatsapp: #25d366;
  --gold: #D6A13C;
}

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

body {
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(74,63,145,0.06) 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(214,161,60,0.07) 0%, transparent 35%),
    #f1f5f9;
  color: var(--noir);
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
}
.login-box {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}
.login-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--vert) 0%, var(--gold) 50%, var(--orange) 100%);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--vert);
}
.login-logo .logo-text span { color: var(--orange); }
.login-logo .logo-sub {
  font-size: 0.85rem;
  color: var(--gris);
  margin-top: 4px;
}
.login-form .field {
  margin-bottom: 18px;
}
.login-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--noir);
  margin-bottom: 6px;
}
.login-form input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-form input:focus { border-color: var(--vert); }
.login-form .btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 6px 18px rgba(74,63,145,0.3);
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
}
.login-form .btn-login:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(74,63,145,0.38);
}
.login-error {
  background: var(--danger-clair);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

.admin-layout {
  display: flex;
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  box-shadow: 0 0 0 1px #e5e7eb, 0 24px 60px rgba(21,20,15,0.06);
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  z-index: 100;
}
.sidebar-header {
  padding: 24px 20px;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  position: relative;
}
.sidebar-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--orange) 50%, var(--vert) 100%);
}
.sidebar-header .logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
}
.sidebar-header .logo-text span { color: var(--gold); }
.sidebar-header .logo-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.78);
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-group {
  margin-bottom: 8px;
}
.nav-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gris-moyen);
  padding: 8px 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--gris);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}
.nav-item:hover {
  background: var(--vert-clair);
  color: var(--vert);
}
.nav-item.active {
  background: var(--vert-clair);
  color: var(--vert-fonce);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--vert);
}
.nav-item .badge {
  margin-left: auto;
  background: var(--orange);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #f3f4f6;
}
.admin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(74,63,145,0.3);
}
.admin-name {
  font-size: 0.85rem;
  font-weight: 600;
}
.admin-role {
  font-size: 0.72rem;
  color: var(--gris);
}
.btn-logout {
  width: 100%;
  padding: 10px;
  background: var(--gris-clair);
  color: var(--gris);
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  background: var(--danger-clair);
  color: var(--danger);
}

.main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 24px 28px;
}
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.7rem;
  margin-bottom: 4px;
}
.page-header p {
  font-size: 0.96rem;
  color: var(--gris);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 20px rgba(15,23,42,0.06);
  border: 1px solid #e5e7eb;
  border-top: 3px solid transparent;
  transition: transform 0.2s cubic-bezier(.25,.8,.25,1), box-shadow 0.2s cubic-bezier(.25,.8,.25,1);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(15,23,42,0.06), 0 16px 32px rgba(15,23,42,0.1);
}
.stat-card:has(.stat-icon.vert) { border-top-color: var(--vert); }
.stat-card:has(.stat-icon.orange) { border-top-color: var(--orange); }
.stat-card:has(.stat-icon.ambre) { border-top-color: #f59e0b; }
.stat-card:has(.stat-icon.purple) { border-top-color: #a855f7; }
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.stat-card .stat-icon.vert { background: linear-gradient(135deg, var(--vert-clair) 0%, #fff 100%); }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, var(--orange-clair) 0%, #fff 100%); }
.stat-card .stat-icon.ambre { background: linear-gradient(135deg, #FEF3C7 0%, #fff 100%); }
.stat-card .stat-icon.purple { background: linear-gradient(135deg, #f3e8ff 0%, #fff 100%); }
.stat-card .stat-value {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.85rem;
  color: var(--noir);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.88rem;
  color: var(--gris);
  margin-top: 6px;
}
.stat-card .stat-change {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 8px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}
.chart-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 20px rgba(15,23,42,0.06);
  border: 1px solid #e5e7eb;
  border-top: 3px solid var(--vert);
}
.chart-card h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.line-chart-wrap {
  height: 220px;
  position: relative;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}
.donut-canvas {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  position: relative;
}
.legend {
  font-size: 0.9rem;
  color: #374151;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.legend-item:last-child { margin-bottom: 0; }
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.table-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 20px rgba(15,23,42,0.06);
  border: 1px solid #e5e7eb;
  border-top: 3px solid var(--vert);
  overflow-x: auto;
}
.table-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-card-header h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.table-card-header .filters {
  display: flex;
  gap: 8px;
}
.filter-btn {
  padding: 6px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gris);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--vert);
  color: var(--vert);
  background: var(--vert-clair);
}
.filter-btn.active {
  border-color: var(--vert);
  color: white;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  box-shadow: 0 4px 10px rgba(74,63,145,0.25);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 24px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gris);
  background: #fafafa;
}
.data-table td {
  padding: 14px 24px;
  font-size: 0.92rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #fafafa; }

.cell-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--vert-clair);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}
.cell-logo img { width: 100%; height: 100%; object-fit: cover; }
.cell-name { font-weight: 600; color: var(--noir); }
.cell-meta { font-size: 0.78rem; color: var(--gris); margin-top: 2px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-actif { background: var(--success-clair); color: var(--success); }
.status-actif::before { background: var(--success); }
.status-en_attente { background: var(--orange-clair); color: var(--warning); }
.status-en_attente::before { background: var(--warning); }
.status-suspendu { background: var(--danger-clair); color: var(--danger); }
.status-suspendu::before { background: var(--danger); }
.status-approuve { background: var(--success-clair); color: var(--success); }
.status-approuve::before { background: var(--success); }
.status-rejete { background: var(--danger-clair); color: var(--danger); }
.status-rejete::before { background: var(--danger); }

.actions {
  display: flex;
  gap: 6px;
}
.btn-action {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action.view { background: var(--info-clair); color: var(--info); }
.btn-action.edit { background: var(--vert-clair); color: var(--vert); }
.btn-action.approve { background: var(--success-clair); color: var(--success); }
.btn-action.reject { background: var(--danger-clair); color: var(--danger); }
.btn-action.delete { background: var(--danger-clair); color: var(--danger); }
.btn-action:hover { opacity: 0.8; transform: translateY(-1px); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
  border-top: 4px solid var(--vert);
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gris);
  line-height: 1;
}
.modal-body { padding: 20px 24px; }
.modal-body .field {
  margin-bottom: 14px;
}
.modal-body label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 5px;
}
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
  border-color: var(--vert);
}
.modal-body textarea { resize: vertical; min-height: 80px; }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; padding: 8px; line-height: 1; opacity: 0.6; transition: opacity 0.15s; }
.pwd-toggle:hover { opacity: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-cancel {
  padding: 10px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: white;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-save {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(74,63,145,0.25);
  transition: filter 0.15s, transform 0.15s;
}
.btn-save:hover { filter: brightness(1.08); transform: translateY(-1px); }

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.toast.show { transform: translateX(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; height: auto; }
  .admin-layout { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }

  .sidebar-header { padding: 14px 16px; }
  .sidebar-header .logo-text { font-size: 1.05rem; }
  .sidebar-nav { padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px; overflow-y: visible; }
  .nav-group { display: contents; }
  .nav-group-title { display: none; }
  .nav-item { width: auto; padding: 7px 12px; font-size: 0.8rem; }
  .sidebar-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px;
  }
  .admin-info { margin-bottom: 0; }
  .btn-logout { width: auto; padding: 8px 14px; white-space: nowrap; }

  .main-content { padding: 16px; }
  .charts-row { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
  .login-page { padding: 16px; }
  .login-box { padding: 32px 22px; }
}
