:root {
  --primary-color: #4f46e5;
  --secondary-color: #06b6d4;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-bg: #0f172a;
  --darker-bg: #020617;
  --card-bg: #1e293b;
  --card-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --sidebar-width: 240px;
  --header-height: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--darker-bg);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--dark-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 1000;
}

.logo-section {
  width: var(--sidebar-width);
}

.logo {
  height: 40px;
  width: auto;
}

.header-message {
  flex: 1;
  text-align: center;
  padding: 0 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notification-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.notification-btn:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-profile:hover {
  background: var(--card-hover);
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background-color: var(--dark-bg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.5rem 1.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 0.9rem;
}

.sidebar-item:hover {
  background-color: var(--card-bg);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: linear-gradient(90deg, var(--primary-color) 0%, transparent 100%);
  color: var(--text-primary);
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
}

.sidebar-item.has-submenu::after {
  content: '›';
  float: right;
  transition: transform 0.3s ease;
}

.sidebar-item.has-submenu.open::after {
  transform: rotate(90deg);
}

.sub-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(0, 0, 0, 0.2);
}

.sub-menu.open {
  max-height: 500px;
}

.sub-menu .sidebar-item {
  padding-left: 3rem;
  font-size: 0.85rem;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 2rem;
  min-height: calc(100vh - var(--header-height));
}

/* Welcome Header */
.welcome-header {
  margin-bottom: 2rem;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.welcome-title span {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(30, 41, 59, 0.5) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.2);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stat-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  font-size: 1.5rem;
  opacity: 0.7;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Section Title */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Quick Access */
.quick-access {
  margin-bottom: 2rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.quick-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.quick-item:hover {
  transform: translateY(-5px);
  background: var(--card-hover);
  border-color: var(--primary-color);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.2);
}

.quick-item-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.quick-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.quick-item-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Notifications Panel */
.notifications-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.notification-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--dark-bg);
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.notification-item:last-child {
  margin-bottom: 0;
}

.notification-item:hover {
  background: var(--card-hover);
  transform: translateX(5px);
}

.notification-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-text {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.notification-time {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.notification-status {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}

.status-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.status-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.status-info {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--secondary-color);
  border: 1px solid var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 1rem;
  }

  .header-message {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .welcome-title {
    font-size: 1.5rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.quick-item,
.notification-item {
  animation: fadeIn 0.5s ease;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--darker-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* ===========================================================================================
   VRL NOTIFICATIONS - SYSTÈME DE NOTIFICATIONS
   ===========================================================================================
   Styles pour le panneau de notifications, les toasts et les animations
   Ajouté pour intégration du système de notifications global
   ======================================================================================== */

/* ============================================
   PANNEAU DE NOTIFICATIONS
   ============================================ */

.notification-panel {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: -400px;
  width: 400px;
  max-width: 90vw;
  max-height: calc(100vh - var(--header-height) - 40px);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.notification-panel.active {
  right: 20px;
}

/* En-tête du panneau */
.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), transparent);
}

.notification-panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
}

.notification-panel-actions {
  display: flex;
  gap: 0.5rem;
}

.notification-action-btn {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.notification-action-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.notification-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--card-hover);
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notification-close-btn:hover {
  background: var(--danger-color);
  transform: rotate(90deg);
}

/* Corps du panneau */
.notification-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.notification-panel-body::-webkit-scrollbar {
  width: 8px;
}

.notification-panel-body::-webkit-scrollbar-track {
  background: var(--darker-bg);
}

.notification-panel-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.notification-panel-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Pied du panneau - SUPPRIMÉ */

/* ============================================
   ITEMS DE NOTIFICATION (dans le panneau)
   ============================================ */

.notification-panel .notification-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
}

.notification-panel .notification-item:hover {
  transform: translateX(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
}

.notification-panel .notification-item.unread {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), transparent);
  border-left: 4px solid var(--primary-color);
}

.notification-panel .notification-item.unread::before {
  content: '';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.notification-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.notification-message {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s ease;
}

.notification-message.expanded {
  display: block;
  -webkit-line-clamp: unset;
  max-height: none;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem;
  border-radius: 8px;
  white-space: pre-wrap;
}

.notification-date {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

.notification-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.notification-mark-read {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-mark-read:hover {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
  transform: scale(1.1);
}

.notification-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.notification-link:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.notification-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.notification-delete-btn:hover {
  background: var(--danger-color);
  color: white;
  border-color: var(--danger-color);
  transform: scale(1.1);
}

.notification-delete-all-btn {
  background: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.notification-delete-all-btn:hover {
  background: var(--danger-color);
  color: white;
}

/* Types de notifications */
.notification-type-decision_fia .notification-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
  color: var(--danger-color);
}

.notification-type-reclamation .notification-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
  color: var(--warning-color);
}

.notification-type-transfert .notification-icon {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
  color: var(--secondary-color);
}

.notification-type-ticket .notification-icon {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(79, 70, 229, 0.1));
  color: var(--primary-color);
}

.notification-type-changement_sl .notification-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
  color: var(--success-color);
}

.notification-type-general .notification-icon {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.1));
  color: var(--text-secondary);
}

/* ============================================
   ÉTATS VIDES ET LOADERS
   ============================================ */

.notification-empty,
.notification-error,
.notification-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.notification-empty-icon,
.notification-error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.notification-empty-text,
.notification-error-text {
  color: var(--text-secondary);
  font-size: 1rem;
}

.notification-retry-btn {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.notification-retry-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   TOASTS DE NOTIFICATION
   ============================================ */

.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 1rem);
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 1rem;
  transform: translateX(450px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: all;
}

.toast.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--danger-color);
}

.toast-warning {
  border-left: 4px solid var(--warning-color);
}

.toast-info {
  border-left: 4px solid var(--secondary-color);
}

/* ============================================
   BADGE DE NOTIFICATION (bouton header)
   ============================================ */

.notification-btn {
  position: relative;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-btn:hover {
  background: var(--card-hover);
  transform: scale(1.1);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* ============================================
   RESPONSIVE NOTIFICATIONS
   ============================================ */

@media (max-width: 768px) {
  .notification-panel {
    right: -100%;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    max-height: calc(100vh - var(--header-height));
  }
  
  .notification-panel.active {
    right: 0;
  }
  
  .toast-container {
    right: 0;
    left: 0;
    padding: 0 1rem;
  }
  
  .toast {
    min-width: auto;
    max-width: 100%;
  }
}