/* ── ADMIN PANEL CSS ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --sky: #416d82; --sky-light: #4a7c93; --sky-pale: #eaf1f4;
  --gold: #C69C2D; --gold-light: #dbc076;
  --white: #FFFFFF; --gray-50: #F8F9FA; --gray-100: #F0F2F5;
  --gray-200: #E2E8F0; --gray-400: #94A3B8; --gray-600: #475569;
  --gray-800: #1E293B; --gray-900: #0F172A;
  --green: #10B981; --red: #EF4444; --orange: #F59E0B;
  --sidebar-w: 260px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06); --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --font: 'Inter', -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w); background: var(--gray-900);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column; overflow-y: auto;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 28px 24px 24px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--sky), var(--gold));
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.sidebar-logo-text { font-weight: 700; font-size: 0.95rem; color: var(--white); }
.sidebar-logo-sub { font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.sidebar-nav { padding: 20px 12px; flex: 1; }
.nav-section-title {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.25); padding: 0 12px; margin-bottom: 8px; margin-top: 24px;
}
.nav-section-title:first-child { margin-top: 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.6);
  text-decoration: none; transition: var(--transition); margin-bottom: 2px;
  position: relative;
}
.sidebar-nav a .icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.sidebar-nav a.active { background: linear-gradient(135deg, rgba(27,108,168,0.3), rgba(201,168,76,0.15)); color: var(--white); }
.sidebar-nav a.active .icon { color: var(--gold); }
.nav-badge {
  margin-left: auto; background: var(--red); color: var(--white);
  font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 50px; min-width: 20px; text-align: center;
}
.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.4);
  font-size: 0.82rem; padding: 10px 14px; border-radius: 10px;
  transition: var(--transition); text-decoration: none;
}
.sidebar-footer a:hover { color: var(--red); background: rgba(239,68,68,0.08); }

/* Main */
.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.admin-topbar {
  position: sticky; top: 0; z-index: 90;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 32px; height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-time { font-size: 0.8rem; color: var(--gray-400); font-weight: 500; }
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky), var(--gold));
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.admin-content { padding: 32px; flex: 1; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 24px; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); transition: var(--transition);
  display: flex; align-items: center; gap: 16px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.blue { background: linear-gradient(135deg, #EBF4FD, #C8E4F9); }
.stat-icon.gold { background: linear-gradient(135deg, #FFF8E7, #FEF0B5); }
.stat-icon.green { background: linear-gradient(135deg, #F0FDF4, #BBF7D0); }
.stat-icon.red { background: linear-gradient(135deg, #FEF2F2, #FECACA); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-change { font-size: 0.75rem; margin-top: 4px; color: var(--green); font-weight: 600; }

/* Tables */
.table-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.table-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white);
}
.table-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.table-subtitle { font-size: 0.78rem; color: var(--gray-400); margin-top: 2px; }
.table-actions { display: flex; gap: 10px; }
.btn-sm {
  padding: 8px 16px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
  border: none; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary-sm { background: var(--sky); color: var(--white); }
.btn-primary-sm:hover { background: var(--sky-light); }
.btn-outline-sm { background: transparent; border: 1.5px solid var(--gray-200); color: var(--gray-600); }
.btn-outline-sm:hover { border-color: var(--sky); color: var(--sky); }
.btn-danger-sm { background: transparent; border: 1.5px solid rgba(239,68,68,0.3); color: var(--red); }
.btn-danger-sm:hover { background: var(--red); color: var(--white); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 14px 20px; font-size: 0.72rem; font-weight: 700;
  color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em;
  text-align: left; border-bottom: 1px solid var(--gray-100); white-space: nowrap;
  background: var(--gray-50);
}
.data-table td {
  padding: 16px 20px; font-size: 0.85rem; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-50); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.data-table .ref { font-weight: 700; color: var(--sky); font-size: 0.8rem; font-family: monospace; }
.data-table .name-cell strong { display: block; color: var(--gray-900); font-size: 0.87rem; }
.data-table .name-cell span { font-size: 0.75rem; color: var(--gray-400); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 50px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.status-nouveau { background: rgba(27,108,168,0.1); color: var(--sky); }
.status-en_cours { background: rgba(245,158,11,0.1); color: var(--orange); }
.status-confirme { background: rgba(16,185,129,0.1); color: var(--green); }
.status-annule { background: rgba(239,68,68,0.1); color: var(--red); }
.status-contacte { background: rgba(201,168,76,0.1); color: var(--gold); }

/* Forms */
.form-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 32px; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.form-card-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 24px; }
.admin-form .form-group { margin-bottom: 18px; }
.admin-form label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--gray-600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em;
}
.admin-form input, .admin-form select, .admin-form textarea {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1.5px solid var(--gray-200); background: var(--gray-50);
  font-size: 0.87rem; color: var(--gray-800); outline: none; transition: var(--transition);
}
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus {
  border-color: var(--sky); background: var(--white);
  box-shadow: 0 0 0 3px rgba(27,108,168,0.08);
}
.admin-form textarea { resize: vertical; min-height: 100px; }
.admin-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Page header */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.page-sub { font-size: 0.875rem; color: var(--gray-400); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--gray-400); margin-bottom: 8px; }
.breadcrumb a { color: var(--sky); text-decoration: none; }

/* Alert system */
.admin-alert {
  padding: 14px 18px; border-radius: 10px; margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 12px; font-size: 0.875rem;
}
.admin-alert.success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.admin-alert.error { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.admin-alert .icon { font-size: 1.1rem; flex-shrink: 0; }

/* Login page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gray-900) 0%, #0F1E3C 50%, #1B3F6E 100%);
  margin-left: 0 !important;
}
.login-card {
  background: var(--white); border-radius: 24px; padding: 48px 40px;
  max-width: 420px; width: 100%; box-shadow: 0 25px 80px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.login-logo h1 { font-size: 1.4rem; color: var(--gray-900); font-weight: 700; }
.login-logo p { font-size: 0.82rem; color: var(--gray-400); margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.login-form input {
  width: 100%; padding: 13px 16px; border-radius: 10px;
  border: 1.5px solid var(--gray-200); font-size: 0.9rem;
  outline: none; transition: var(--transition); background: var(--gray-50);
}
.login-form input:focus { border-color: var(--sky); background: var(--white); box-shadow: 0 0 0 3px rgba(27,108,168,0.08); }
.login-btn {
  width: 100%; padding: 14px; background: linear-gradient(135deg, var(--sky), #1456A0);
  color: var(--white); border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 16px rgba(27,108,168,0.35);
}
.login-btn:hover { box-shadow: 0 8px 24px rgba(27,108,168,0.5); transform: translateY(-2px); }
.login-error {
  background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA;
  border-radius: 8px; padding: 12px 16px; font-size: 0.85rem;
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}

/* Responsive admin */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-form .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 20px 16px; }
}
