/* ============================================================
   admin/assets/css/admin.css — Styles back-office
   ============================================================ */

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

:root {
  --bg: #f0f2f5;
  --sidebar-bg: #1e2d45;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --sidebar-width: 240px;
  --header-height: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- LAYOUT ---- */
.page-wrapper { display: flex; min-height: calc(100vh - var(--header-height)); }

/* ---- HEADER ---- */
.admin-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 0 calc(var(--sidebar-width) + 20px);
}
.header-title { font-size: 15px; font-weight: 600; color: var(--text); }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: var(--header-height); left: 0; bottom: 0;
  width: var(--sidebar-width); background: var(--sidebar-bg);
  overflow-y: auto; z-index: 50;
  display: flex; flex-direction: column;
}
.sidebar-logo {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo h2 { color: white; font-size: 15px; font-weight: 700; }
.sidebar-logo p { color: var(--sidebar-text); font-size: 11px; margin-top: 2px; }

.sidebar-section { padding: 16px 10px 8px; }
.sidebar-section-title {
  color: rgba(148,163,184,0.5); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0 6px; margin-bottom: 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text);
  font-size: 13px; font-weight: 500; transition: all 0.15s; cursor: pointer;
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: white; text-decoration: none; }
.sidebar-link.active { background: rgba(59,130,246,0.15); color: white; }
.sidebar-link.active .sidebar-icon { color: var(--sidebar-active); }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto; padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ---- MAIN ---- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px; flex: 1;
}
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ---- KPI ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px;
}
.kpi-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.kpi-icon.blue { background: #eff6ff; }
.kpi-icon.green { background: #f0fdf4; }
.kpi-icon.orange { background: #fffbeb; }
.kpi-icon.red { background: #fef2f2; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--text); }
.kpi-label { font-size: 12px; color: var(--text-muted); }

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ---- CARD ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: #f8fafc; padding: 10px 16px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  text-align: left; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }

/* ---- BADGES ---- */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.badge-tantiemes, .badge-validee { background: #eff6ff; color: #1d4ed8; }
.badge-groupe { background: #f5f3ff; color: #5b21b6; }
.badge-consommation { background: #ecfdf5; color: #065f46; }
.badge-brouillon { background: #f1f5f9; color: #475569; }
.badge-cloturee { background: #f0fdf4; color: #15803d; }
.badge-en_attente { background: #fffbeb; color: #92400e; }
.badge-paye { background: #ecfdf5; color: #065f46; }
.badge-en_retard { background: #fef2f2; color: #991b1b; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: white; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-control {
  display: block; width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: var(--text); background: var(--surface);
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ---- QUICK ACTIONS ---- */
.quick-actions { display: flex; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.quick-action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.quick-action-btn:hover { background: var(--accent); color: white; border-color: var(--accent); text-decoration: none; }

/* ---- UTILS ---- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); --sidebar-width: 240px; }
  .admin-header { padding-left: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
