/* ==========================================================================
   MANAGER - Design System Light Theme
   Un design clair, moderne et professionnel
   ========================================================================== */

/* ==========================================================================
   1. CSS VARIABLES & ROOT
   ========================================================================== */
:root {
  /* Couleurs principales */
  --primary: #4f46e5;          /* Indigo profond */
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  
  /* Couleurs secondaires */
  --secondary: #64748b;        /* Slate */
  --secondary-light: #94a3b8;
  --secondary-dark: #475569;
  
  /* Couleurs de statut */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #06b6d4;
  --info-light: #cffafe;
  
  /* Neutres */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Ombres */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Bordures */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Espacements */
  --navbar-height: 64px;
  --sidebar-width: 260px;
}

/* ==========================================================================
   2. RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--gray-700);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   3. NAVBAR
   ========================================================================== */
.navbar-main {
  height: var(--navbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--primary-dark);
}

.navbar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.25rem;
}

.navbar-menu-btn {
  background: transparent;
  border: none;
  padding: 0.5rem;
  margin-right: 1rem;
  cursor: pointer;
  color: var(--gray-600);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.navbar-menu-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-50) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
}

.navbar-user-name {
  font-weight: 500;
  color: var(--gray-700);
}

/* ==========================================================================
   4. SIDEBAR / OFFCANVAS
   ========================================================================== */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  z-index: 999;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.sidebar.show {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-item {
  margin-bottom: 0.25rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  font-weight: 500;
}

.sidebar-nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.sidebar-nav-link.active {
  background: var(--primary-50);
  color: var(--primary);
}

.sidebar-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-nav-link i {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

.sidebar-nav-link.logout {
  color: var(--danger);
}

.sidebar-nav-link.logout:hover {
  background: var(--danger-light);
}

/* ==========================================================================
   5. MAIN CONTENT
   ========================================================================== */
.main-content {
  padding-top: calc(var(--navbar-height) + 2rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ==========================================================================
   6. PAGE HEADER
   ========================================================================== */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   7. CARDS
   ========================================================================== */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* Stat Cards */
.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.primary {
  background: var(--primary-100);
  color: var(--primary);
}

.stat-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-icon.info {
  background: var(--info-light);
  color: var(--info);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* ==========================================================================
   8. BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  color: var(--white);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: var(--white);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  color: var(--white);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: var(--white);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* ==========================================================================
   9. TABLES
   ========================================================================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  background: var(--white);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

.table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.table td {
  padding: 1rem 1.25rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table tbody tr {
  transition: var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   10. FORMS
   ========================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control::placeholder {
  color: var(--gray-400);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.375rem;
}

/* ==========================================================================
   11. BADGES & TAGS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--primary-100);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: #b45309;
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-secondary {
  background: var(--gray-200);
  color: var(--gray-600);
}

/* ==========================================================================
   12. MODALS
   ========================================================================== */
.modal {
  --bs-modal-border-radius: var(--radius-xl);
  --bs-modal-header-padding: 1.5rem;
  --bs-modal-padding: 1.5rem;
}

.modal-header {
  border-bottom: 1px solid var(--gray-200);
}

.modal-title {
  font-weight: 600;
  color: var(--gray-900);
}

.modal-footer {
  border-top: 1px solid var(--gray-200);
  gap: 0.75rem;
}

/* ==========================================================================
   13. EMPTY STATES
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--gray-400);
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   14. DASHBOARD GRID
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.quick-action-card {
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition-normal);
}

.quick-action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.quick-action-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--primary);
}

.quick-action-title {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.quick-action-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

/* ==========================================================================
   15. TOAST NOTIFICATIONS
   ========================================================================== */
#toastContainer {
  position: fixed;
  top: calc(var(--navbar-height) + 1rem);
  right: 1rem;
  z-index: 1100;
}

.toast {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: none;
}

/* ==========================================================================
   16. LOGIN PAGE
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 1rem;
}

.login-header {
  text-align: center;
  padding: 2rem 2rem 1rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--white);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--gray-500);
}

.login-body {
  padding: 1.5rem 2rem 2rem;
}

/* ==========================================================================
   17. UTILITIES
   ========================================================================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--gray-500) !important; }

.bg-primary-light { background: var(--primary-50) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }

.fw-semibold { font-weight: 600; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-auto { margin-top: auto; }
.ms-auto { margin-left: auto; }
.me-auto { margin-right: auto; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* ==========================================================================
   18. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slide-in {
  animation: slideInRight 0.3s ease forwards;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button[disabled].loading {
  position: relative;
  pointer-events: none;
}

button[disabled].loading::after {
  content: '';
  position: absolute;
  right: 1rem;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.75s linear infinite;
}

/* ==========================================================================
   19. RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .main-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .table th, .table td {
    padding: 0.75rem 1rem;
  }
  
  .navbar-user-name {
    display: none;
  }
}

@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
    top: var(--navbar-height);
  }
  
  .main-content {
    margin-left: var(--sidebar-width);
  }
  
  .sidebar-overlay {
    display: none;
  }
  
  .navbar-menu-btn {
    display: none;
  }
}

/* ==========================================================================
   20. PRINT STYLES
   ========================================================================== */
@media print {
  .navbar-main,
  .sidebar,
  .btn,
  .no-print {
    display: none !important;
  }
  
  .main-content {
    margin: 0;
    padding: 0;
  }
}
