/* ============================================
   RESPONSIVE LAYOUT - MISE EN PAGE PROFESSIONNELLE
   YABISO HUB - Toutes les pages
   ============================================ */

/* ROOT - Variables et base */
:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --light: #f8fafc;
  --border: #e2e8f0;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
}

/* ============================================
   CARDS - Structure de base
   ============================================ */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 12px 12px 0 0;
  padding: 1.25rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background: var(--light);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: 0 0 12px 12px;
}

/* ============================================
   STAT CARDS - Cartes d'indicateurs
   ============================================ */
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.5rem 0;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================
   NOTIFICATION BADGE - Compteur de notifications
   ============================================ */
.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 24px;
  padding: 0;
  border: 2px solid white;
}

.notification-badge.hidden {
  display: none;
}

.icon-button {
  position: relative;
}

.notification-menu {
  min-width: 320px;
  max-width: 420px;
  max-height: 420px;
  overflow-y: auto;
}

/* ============================================
   PRODUCT PAGE GRID - Alignement des blocs produits
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.card-stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.card-stat:hover {
  box-shadow: var(--shadow-md);
}

.card-stat h5 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.stat-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
  background: var(--light);
  color: var(--primary);
  font-size: 1.25rem;
}

.stat-card .icon.primary {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
}

.stat-card .icon.stock {
  background: rgba(15, 23, 42, 0.08);
  color: var(--primary);
}

.stat-card .icon.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.stat-card .icon.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.stock-progress {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.stock-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--info);
  transition: width 0.3s ease;
}

.stock-progress-fill.ok {
  background: var(--success);
}

.stock-progress-fill.low {
  background: var(--warning);
}

.stock-progress-fill.empty {
  background: var(--danger);
}

/* ============================================
   PROFILE DROPDOWN - Desktop & mobile
   ============================================ */
.navbar-actions .dropdown {
  position: relative;
}

.profile-button {
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  box-shadow: none !important;
}

.profile-button:hover {
  opacity: 0.8;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  color: #1e293b;
  text-decoration: none;
  display: block;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: #f8fafc;
  color: #0f172a;
}

.dropdown-divider {
  margin: 0.25rem 0;
  border: none;
  border-top: 1px solid #e2e8f0;
  opacity: 1;
}

.stat-card .stat-trend {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.stat-card .stat-trend.up {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.stat-card .stat-trend.down {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ============================================
   TABLE STYLES - Tableaux professionnels
   ============================================ */
.table {
  border-collapse: collapse;
  background: white;
}

.table thead th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  padding: 1rem;
  border: none;
  text-align: left;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background-color: var(--light);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   BUTTONS - Boutons cohérents
   ============================================ */
.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline-primary {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--accent);
  color: white;
}

/* ============================================
   BADGES - Étiquettes
   ============================================ */
.badge {
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
}

.badge-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

/* ============================================
   FORMS - Formulaires responsifs
   ============================================ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  display: block;
}

.form-control,
.form-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ============================================
   ALERTS - Alertes et notifications
   ============================================ */
.alert {
  border-radius: 8px;
  border: 1px solid;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.alert-primary {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
  color: var(--warning);
}

/* ============================================
   SECTIONS - Organisation de contenu
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header .section-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================
   MODAL IMPROVEMENTS
   ============================================ */
.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 12px 12px 0 0;
}

.modal-header .btn-close {
  filter: invert(1);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobiles (< 576px) */
@media (max-width: 575.98px) {
  .stat-card {
    margin-bottom: 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .section-header .section-actions {
    width: 100%;
  }

  .section-header .section-actions .btn {
    flex: 1;
    min-width: 100px;
  }

  .table {
    font-size: 0.875rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.75rem 0.5rem;
  }

  .card-body {
    padding: 1rem;
  }
}

/* Tablettes (576px - 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .stat-card {
    margin-bottom: 1rem;
  }
}

/* Desktop (≥ 768px) */
@media (min-width: 768px) {
  .stat-card {
    margin-bottom: 1.5rem;
  }
}

/* ============================================
   GRID HELPERS - Espacement
   ============================================ */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 2rem !important; }

.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

/* ============================================
   UTILITIES - Classes utilitaires
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.bg-light { background-color: var(--light); }
.bg-white { background-color: white; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}
