:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --border-radius: 0.375rem;
  --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
  --border-color: #dee2e6;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background-color: #f8f9fa;
  color: var(--dark-color);
  line-height: 1.6;
}

.admin-header {
  background-color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.admin-info {
  margin-right: 1rem;
  color: var(--secondary-color);
}

.btn-primary, .btn-secondary, .logout-btn, .back-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.btn-secondary {
  background-color: var(--light-color);
  color: var(--dark-color);
  border: 1px solid var(--border-color);
}

.logout-btn, .back-btn {
  background-color: var(--light-color);
  color: var(--dark-color);
  border: 1px solid var(--border-color);
  margin-left: 0.5rem;
}

.logout-btn:hover, .back-btn:hover {
  background-color: #e9ecef;
}

.btn-primary:hover {
  background-color: #0b5ed7;
}

.btn-secondary:hover {
  background-color: #e9ecef;
}

.btn-primary:active, .btn-secondary:active, .logout-btn:active, .back-btn:active {
  transform: scale(0.98);
}

.admin-main {
  display: flex;
  padding: 1rem;
  gap: 1rem;
}

.admin-nav {
  width: 200px;
  background-color: white;
  border-radius: var(--border-radius);
  padding: 1rem;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.75rem;
  background: none;
  border: none;
  text-align: left;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.nav-btn:hover, .nav-btn.active {
  background-color: var(--primary-color);
  color: white;
}

.nav-btn.active {
  font-weight: bold;
}

.admin-section {
  flex: 1;
  background-color: white;
  border-radius: var(--border-radius);
  padding: 1rem;
  box-shadow: var(--box-shadow);
  display: none;
}

.admin-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    text-align: center;
  }

  .section-header h2 {
    width: 100%;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  text-align: center;
}

.stat-card h3 {
  margin-top: 0;
  color: var(--secondary-color);
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--dark-color);
}

.recent-activity {
  margin-top: 2rem;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--light-color);
  padding: 1rem;
  border-radius: var(--border-radius);
}

.activity-icon {
  font-size: 2rem;
}

.activity-text {
  flex: 1;
}

.activity-time {
  color: var(--secondary-color);
  font-size: 0.8rem;
}

.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filters input, .filters select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  flex: 1;
  min-width: 150px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.admin-table th, .admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background-color: var(--light-color);
  font-weight: bold;
}

.product-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 0.25rem;
}

.source-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  display: inline-block;
}

.source-aliexpress {
  background-color: #ff6b00;
  color: white;
}

.source-amazon {
  background-color: #ff9900;
  color: white;
}

.source-other {
  background-color: #e9ecef;
  color: var(--dark-color);
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  display: inline-block;
}

.status-active {
  background-color: var(--success-color);
  color: white;
}

.status-inactive {
  background-color: var(--secondary-color);
  color: white;
}

.role-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  display: inline-block;
}

.role-admin {
  background-color: var(--danger-color);
  color: white;
}

.role-user {
  background-color: var(--info-color);
  color: var(--dark-color);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background-color: white;
  border-radius: var(--border-radius);
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  background-color: var(--light-color);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem; /* Ajouter du padding */
}

.modal-content {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh; /* Limiter la hauteur */
  overflow-y: auto; /* Scroll si nécessaire */
  box-shadow: var(--box-shadow);
  margin: auto; /* Centrer */
}

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

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--secondary-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.product-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 100%;
}

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

/* Ajout de responsive pour les petites écrans */
@media (max-width: 576px) {
  .modal {
    padding: 0.5rem;
  }

  .modal-content {
    padding: 1rem;
    max-height: 95vh;
  }

  .product-form .form-row {
    grid-template-columns: 1fr; /* Une colonne sur mobile */
    gap: 0.5rem;
  }
}

/* Style pour l'aperçu d'image */
.image-preview {
  margin-top: 0.5rem;
  text-align: center;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px dashed var(--border-color);
}

.image-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview p {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--secondary-color);
}

/* Amélioration du formulaire et du modal */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Correction pour le bouton "Ajouter un produit" */
@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .section-header h2 {
    width: 100%;
    margin-bottom: 1rem;
  }

  .btn-primary {
    align-self: center;
  }
}

/* Style pour le tableau de contrôle */
.access-denied {
  padding: 2rem;
  text-align: center;
  max-width: 600px;
  margin: 2rem auto;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem;
  background-color: var(--success-color);
  color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  display: none;
}

.notification.error {
  background-color: var(--danger-color);
}

/* Style pour la table des utilisateurs */
.users-table-container {
  overflow-x: auto;
}

.admin-table td {
  vertical-align: middle;
}

.user-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

/* Styles pour la section des avis */
.review-card {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.review-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  align-items: center;
}

.review-content {
  margin-bottom: 1rem;
}

.review-actions {
  text-align: right;
}

/* Style pour la section des paramètres */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.setting-card {
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  padding: 1rem;
}

.setting-card h3 {
  margin-top: 0;
}

/* Styles pour les boutons dans les cartes de paramètres */
.setting-card .btn-secondary {
  margin-top: 0.5rem;
  width: 100%;
}

/* Ajout de styles pour les petites images et badges */
.product-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Responsive pour tablettes et mobiles */
@media (max-width: 768px) {
  .admin-header {
    flex-direction: column;
    padding: 1rem;
    text-align: center;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-right {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
  }

  .admin-main {
    flex-direction: column;
  }

  .admin-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }

  .nav-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.5rem;
  }

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

  .filters {
    flex-direction: column;
  }

  .filters input, .filters select {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: center;
  }
}
