/* ============================================================
   ADMIN — Layout sidebar, formulaires, tableaux admin
   ============================================================ */

/* ===== LAYOUT ADMIN ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #f0f2f5;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: var(--z-sticky);
  overflow-y: auto;
  transition: transform var(--t-base);
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-header .logo-main  { color: white; font-size: var(--text-base); }
.sidebar-header .logo-sub   { color: rgba(255,255,255,0.5); }
.admin-sidebar nav { padding: 16px 12px; flex: 1; }
.sidebar-section-label {
  padding: 8px 10px 4px;
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all var(--t-fast);
  margin-bottom: 2px;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: white;
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--primary-light);
  color: white;
}
.sidebar-link .link-icon { font-size: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .sidebar-link { color: rgba(255,255,255,0.5); }

/* Contenu principal admin */
.admin-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar admin */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.topbar-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--primary-dark);
}
.topbar-title span { color: var(--text-muted); font-weight: var(--fw-normal); font-size: var(--text-base); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
}

/* Zone de contenu */
.admin-page {
  padding: 28px;
  flex: 1;
}
.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.admin-page-header h1 {
  font-size: var(--text-3xl);
  color: var(--primary-dark);
}
.admin-page-header p { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }

/* Cartes admin */
.admin-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}
.admin-card-header h3 {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--primary-dark);
}
.admin-card-body { padding: 20px 24px; }

/* Cartes statistiques dashboard */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-base);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-card-icon.blue    { background: var(--primary-100); }
.stat-card-icon.green   { background: var(--secondary-100); }
.stat-card-icon.amber   { background: var(--accent-100); }
.stat-card-icon.purple  { background: #f5f3ff; }
.stat-card-info .count {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--primary-dark);
  line-height: 1;
}
.stat-card-info .label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tableau admin */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.admin-table th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-surface); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .actions { display: flex; align-items: center; gap: 8px; }

/* ===== FORMULAIRES ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label.required::after { content: ' *'; color: var(--status-danger); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-100);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-control.is-invalid { border-color: var(--status-danger); }
.form-error { font-size: var(--text-xs); color: var(--status-danger); margin-top: 4px; }
.form-hint  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== ZONE D'UPLOAD ===== */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--t-base);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary-color);
  background: var(--primary-100);
}
.upload-zone .upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone h4 { font-size: var(--text-base); color: var(--primary-dark); margin-bottom: 6px; }
.upload-zone p { font-size: var(--text-sm); color: var(--text-muted); }
.upload-zone input[type=file] { display: none; }

/* Fichiers en attente d'upload */
.upload-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.upload-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-file-size { font-size: var(--text-xs); color: var(--text-muted); }
.upload-progress { flex: 1; }
.progress-bar-wrap {
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-bar {
  height: 100%;
  background: var(--gradient-section-header);
  border-radius: var(--radius-full);
  transition: width var(--t-base);
}
.progress-pct { font-size: var(--text-xs); color: var(--text-muted); }

/* ===== PAGE DE CONNEXION ADMIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-hero);
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}
.login-header { text-align: center; margin-bottom: 36px; }
.login-header .login-icon {
  width: 64px; height: 64px;
  background: var(--gradient-hero);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}
.login-header h1 {
  font-size: var(--text-2xl);
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.login-header p { font-size: var(--text-sm); color: var(--text-muted); }
.login-error {
  background: var(--status-danger-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: var(--text-sm);
  color: var(--status-danger);
  margin-bottom: 20px;
  display: none;
}
.login-error.show { display: block; }

/* ===== HAMBURGUER ADMIN MOBILE ===== */
.admin-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: calc(var(--z-sticky) + 10);
  width: 50px; height: 50px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  font-size: 22px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1023px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-content {
    margin-left: 0;
  }
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-mobile-toggle {
    display: flex;
  }
}
@media (max-width: 767px) {
  .admin-page { padding: 16px; }
  .dashboard-stats { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}
