/* ============================================================================
   ADMIN INTERFACE - MOBILE FIRST
   Panneau d'administration professionnel et responsive
   ============================================================================ */

/* Variables Admin */
:root {
  --admin-sidebar-width: 280px;
  --admin-header-height: 64px;
}

/* ============================================================================
   LAYOUT - MOBILE FIRST
   ============================================================================ */

.admin-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-slate-50);
}

.admin-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-slate-200);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.admin-header-logo {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 200px;
}

.admin-header-logo svg {
  width: 32px;
  height: 32px;
  color: var(--color-primary-600);
}

.admin-main-content {
  display: flex;
  flex: 1;
  gap: 0;
}

/* Sidebar - Mobile first (hidden par défaut) */
.admin-sidebar {
  position: fixed;
  left: -100%;
  top: var(--admin-header-height);
  width: 100%;
  max-width: var(--admin-sidebar-width);
  height: calc(100vh - var(--admin-header-height));
  background: var(--color-slate-900);
  padding: var(--space-lg);
  transition: left var(--transition-base);
  z-index: 99;
  overflow-y: auto;
}

.admin-sidebar.active {
  left: 0;
}

/* Desktop: sidebar toujours visible */
@media (min-width: 1024px) {
  .admin-sidebar {
    position: relative;
    left: 0 !important;
    width: var(--admin-sidebar-width);
    height: auto;
  }
}

.admin-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--color-slate-900);
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: background var(--transition-base);
}

.admin-sidebar-toggle:hover {
  background: var(--color-slate-100);
}

.admin-sidebar-toggle svg {
  width: 24px;
  height: 24px;
}

.admin-sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
}

.admin-sidebar-item {
  position: relative;
}

.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--color-slate-300);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  border-left: 3px solid transparent;
}

.admin-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
}

.admin-sidebar-link.active {
  background: var(--color-primary-600);
  color: var(--color-white);
  border-left-color: var(--color-white);
}

.admin-sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main content */
.admin-main {
  flex: 1;
  padding: var(--space-lg);
  overflow-y: auto;
  width: 100%;
}

@media (min-width: 1024px) {
  .admin-main {
    width: calc(100% - var(--admin-sidebar-width));
  }
}

/* Page header */
.admin-page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.admin-page-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
  margin: 0;
}

.admin-page-title svg {
  width: 32px;
  height: 32px;
  color: var(--color-primary-600);
}

.admin-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.admin-page-actions .btn {
  flex: 1;
  min-width: 150px;
}

/* ============================================================================
   TABLES
   ============================================================================ */

.admin-table-wrapper {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead {
  background: var(--color-slate-100);
  border-bottom: 1px solid var(--color-slate-200);
}

.admin-table th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-slate-100);
  font-size: var(--font-size-sm);
}

.admin-table tbody tr {
  transition: background var(--transition-base);
}

.admin-table tbody tr:hover {
  background: var(--color-slate-50);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Actions */
.admin-table-actions {
  display: flex;
  gap: var(--space-sm);
}

.admin-table-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-slate-100);
  color: var(--color-slate-600);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0;
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.admin-table-action-btn:hover {
  background: var(--color-primary-100);
  color: var(--color-primary-600);
}

.admin-table-action-btn.danger:hover {
  background: var(--color-red-100);
  color: var(--color-red-600);
}

.admin-table-action-btn svg {
  width: 18px;
  height: 18px;
}

/* Empty state */
.admin-table-empty {
  text-align: center;
  padding: var(--space-lg) var(--space-lg);
  color: var(--color-slate-500);
}

.admin-table-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

/* ============================================================================
   CARTES/PANELS
   ============================================================================ */

.admin-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-slate-200);
}

.admin-card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.admin-card-title svg {
  width: 24px;
  height: 24px;
  color: var(--color-primary-600);
}

.admin-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Stats Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.admin-stat-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.admin-stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-stat-icon.primary {
  background: var(--color-primary-100);
  color: var(--color-primary-600);
}

.admin-stat-icon.success {
  background: var(--color-green-100);
  color: var(--color-green-600);
}

.admin-stat-icon.warning {
  background: var(--color-amber-100);
  color: var(--color-amber-600);
}

.admin-stat-icon.danger {
  background: var(--color-red-100);
  color: var(--color-red-600);
}

.admin-stat-icon svg {
  width: 28px;
  height: 28px;
}

.admin-stat-content {
  flex: 1;
}

.admin-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.admin-stat-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
}

/* ============================================================================
   FORMULAIRES
   ============================================================================ */

.admin-form {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.admin-form-group:last-child {
  margin-bottom: 0;
}

.admin-form-label {
  font-weight: var(--font-weight-medium);
  color: var(--color-slate-900);
  font-size: var(--font-size-sm);
}

.admin-form-label .required {
  color: var(--color-red-600);
}

.admin-form-input,
.admin-form-select,
.admin-form-textarea {
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-slate-300);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-family: inherit;
  transition: all var(--transition-base);
}

.admin-form-input:focus,
.admin-form-select:focus,
.admin-form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.admin-form-textarea {
  resize: vertical;
  min-height: 120px;
}

.admin-form-helper {
  font-size: var(--font-size-xs);
  color: var(--color-slate-500);
}

.admin-form-error {
  font-size: var(--font-size-xs);
  color: var(--color-red-600);
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-slate-200);
}

.admin-form-actions .btn {
  flex: 1;
  min-width: 150px;
}

/* ============================================================================
   MODALES
   ============================================================================ */

.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
}

.admin-modal.active {
  display: flex;
}

.admin-modal-content {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-slate-200);
}

.admin-modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-slate-900);
  margin: 0;
}

.admin-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--color-slate-400);
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  font-size: var(--font-size-lg);
}

.admin-modal-close:hover {
  background: var(--color-slate-100);
  color: var(--color-slate-900);
}

.admin-modal-body {
  margin-bottom: var(--space-lg);
}

.admin-modal-footer {
  display: flex;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-slate-200);
}

.admin-modal-footer .btn {
  flex: 1;
}

/* ============================================================================
   MESSAGES/ALERTES
   ============================================================================ */

.admin-alert {
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.admin-alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.admin-alert-content {
  flex: 1;
}

.admin-alert-title {
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-xs);
}

.admin-alert-success {
  background: var(--color-green-50);
  color: var(--color-green-900);
  border: 1px solid var(--color-green-200);
}

.admin-alert-success svg {
  color: var(--color-green-600);
}

.admin-alert-error {
  background: var(--color-red-50);
  color: var(--color-red-900);
  border: 1px solid var(--color-red-200);
}

.admin-alert-error svg {
  color: var(--color-red-600);
}

.admin-alert-warning {
  background: var(--color-amber-50);
  color: var(--color-amber-900);
  border: 1px solid var(--color-amber-200);
}

.admin-alert-warning svg {
  color: var(--color-amber-600);
}

.admin-alert-info {
  background: var(--color-blue-50);
  color: var(--color-blue-900);
  border: 1px solid var(--color-blue-200);
}

.admin-alert-info svg {
  color: var(--color-blue-600);
}

/* ============================================================================
   RESPONSIVE - TABLET (640px+)
   ============================================================================ */

@media (min-width: 640px) {
  .admin-page-actions .btn {
    flex: initial;
    min-width: auto;
  }

  .admin-form-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
   RESPONSIVE - DESKTOP (768px+)
   ============================================================================ */

@media (min-width: 768px) {
  /* Sidebar toujours visible sur desktop */
  .admin-sidebar {
    position: static;
    width: var(--admin-sidebar-width);
    height: auto;
    max-height: calc(100vh - var(--admin-header-height));
    left: auto;
    top: auto;
    background: var(--color-slate-900);
    border-right: 1px solid var(--color-slate-800);
  }

  .admin-sidebar-toggle {
    display: none;
  }

  .admin-main {
    padding: var(--space-2xl);
  }

  .admin-page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .admin-page-title {
    margin-bottom: 0;
  }

  .admin-page-actions {
    flex-wrap: nowrap;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .admin-form-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .admin-table {
    font-size: var(--font-size-sm);
  }

  .admin-table th,
  .admin-table td {
    padding: var(--space-md) var(--space-lg);
  }
}

/* ============================================================================
   RESPONSIVE - LARGE DESKTOP (1024px+)
   ============================================================================ */

@media (min-width: 1024px) {
  .admin-sidebar {
    position: sticky;
    top: var(--admin-header-height);
    height: calc(100vh - var(--admin-header-height));
    overflow-y: auto;
  }

  .admin-form-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
