/* ========================================
   SYSTÈME DE NOTIFICATIONS - STYLE
   ======================================== */

/* Conteneur principal des notifications */
#notification-system {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 16px;
  z-index: 1000;
}

/* Bell/Cloche de notification */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  background: var(--surface-variant, #374151);
  border: 1px solid var(--border-color, #4b5563);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.notification-bell:hover {
  background: var(--surface-hover, #4b5563);
  border-color: var(--primary, #3b82f6);
  transform: scale(1.05);
}

.bell-icon {
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

.notification-bell:hover .bell-icon {
  animation: bellRing 0.6s ease-in-out;
}

@keyframes bellRing {
  0%, 50%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* Badge de notifications non lues */
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--error, #ef4444);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 0.7em;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
  border: 2px solid var(--surface, #1f2937);
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Dropdown des notifications */
.notification-dropdown {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: 500px;
  background: var(--surface, #1f2937);
  border: 1px solid var(--border-color, #4b5563);
  border-radius: var(--border-radius, 8px);
  box-shadow: var(--shadow-elevated, 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2));
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
  z-index: 9999;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header du dropdown */
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--surface-variant, #374151);
  border-bottom: 1px solid var(--border-color, #4b5563);
  position: sticky;
  top: 0;
  z-index: 10;
}

.notification-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #fafafa;
  font-size: 1.05em;
}

.notification-title .notification-icon {
  font-size: 1.1em;
}

.notification-actions {
  display: flex;
  gap: 8px;
}

.mark-all-read-btn,
.close-notifications-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  color: #d4d4d8;
  transition: all 0.2s ease;
  font-size: 0.9em;
}

.mark-all-read-btn:hover,
.close-notifications-btn:hover {
  background: var(--surface-hover, #4b5563);
  color: #fafafa;
  transform: scale(1.1);
}

/* Liste des notifications */
.notification-list {
  max-height: 350px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #4b5563) transparent;
}

.notification-list::-webkit-scrollbar {
  width: 6px;
}

.notification-list::-webkit-scrollbar-track {
  background: transparent;
}

.notification-list::-webkit-scrollbar-thumb {
  background: var(--border-color, #4b5563);
  border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary, #9ca3af);
}

/* Item de notification */
.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #4b5563);
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--surface, #1f2937);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--surface-hover, #374151);
}

.notification-item.unread {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
  border-left: 3px solid var(--primary, #3b82f6);
}

.notification-item.unread .notification-message {
  font-weight: 500;
}

.notification-item.priority-high {
  border-left-color: var(--error);
}

.notification-item.priority-medium {
  border-left-color: var(--warning);
}

.notification-item.priority-low {
  border-left-color: var(--success);
}

/* Contenu de la notification */
.notification-content {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.notification-content .notification-icon {
  font-size: 1.3em;
  margin-top: 2px;
  flex-shrink: 0;
}

.notification-body {
  flex: 1;
  min-width: 0;
}

.notification-header-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.notification-type {
  font-size: 0.85em;
  font-weight: 600;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-time {
  font-size: 0.75em;
  color: #a1a1aa;
  flex-shrink: 0;
}

.notification-message {
  color: #fafafa;
  font-size: 0.9em;
  line-height: 1.4;
  margin-bottom: 4px;
  word-wrap: break-word;
}

.notification-details {
  color: #d4d4d8;
  font-size: 0.8em;
  line-height: 1.3;
  word-wrap: break-word;
}

/* Actions sur les notifications */
.notification-actions-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 8px;
  flex-shrink: 0;
}

.mark-read-btn,
.delete-notification-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-tertiary, #6b7280);
  transition: all 0.2s ease;
  font-size: 0.8em;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark-read-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success, #10b981);
  transform: scale(1.1);
}

.delete-notification-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error, #ef4444);
  transform: scale(1.1);
}

/* État "Aucune notification" */
.no-notifications {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #d4d4d8;
  background: var(--surface, #1f2937);
}

.no-notif-icon {
  font-size: 2.5em;
  margin-bottom: 12px;
  opacity: 0.8;
  color: #a1a1aa;
}

.no-notifications p {
  margin: 0;
  font-size: 0.9em;
  line-height: 1.4;
  color: #d4d4d8;
}

/* Footer du dropdown */
.notification-footer {
  padding: 12px 16px;
  background: var(--surface-variant, #374151);
  border-top: 1px solid var(--border-color, #4b5563);
  display: flex;
  justify-content: center;
}

.clear-old-btn {
  background: none;
  border: 1px solid var(--border-color, #4b5563);
  padding: 6px 12px;
  border-radius: var(--border-radius, 8px);
  cursor: pointer;
  color: #d4d4d8;
  font-size: 0.8em;
  transition: all 0.2s ease;
}

.clear-old-btn:hover {
  background: var(--surface-hover, #4b5563);
  border-color: #60a5fa;
  color: #60a5fa;
}

/* Animation pour les nouvelles notifications */
.notification-item.new-notification {
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .notification-dropdown {
    width: 320px;
    max-height: 400px;
  }
  
  .notification-bell {
    width: 36px;
    height: 36px;
  }
  
  .bell-icon {
    font-size: 1.1em;
  }
  
  .notification-badge {
    font-size: 0.65em;
    padding: 2px 5px;
  }
}

@media (max-width: 480px) {
  .notification-dropdown {
    width: calc(100vw - 20px);
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .notification-list {
    max-height: 300px;
  }
  
  .notification-item {
    padding: 10px 12px;
  }
  
  .notification-message {
    font-size: 0.85em;
  }
}

/* Variables CSS pour les couleurs de notification */
:root {
  --notification-success: #10b981;
  --notification-warning: #f59e0b;
  --notification-error: #ef4444;
  --notification-info: #3b82f6;
  
  --notification-success-alpha: rgba(16, 185, 129, 0.1);
  --notification-warning-alpha: rgba(245, 158, 11, 0.1);
  --notification-error-alpha: rgba(239, 68, 68, 0.1);
  --notification-info-alpha: rgba(59, 130, 246, 0.1);
}

/* Styles spécifiques pour les types de notification */
.notification-item[data-type="success"] {
  border-left-color: var(--notification-success);
}

.notification-item[data-type="success"].unread {
  background: linear-gradient(90deg, var(--notification-success-alpha) 0%, transparent 100%);
}

.notification-item[data-type="warning"] {
  border-left-color: var(--notification-warning);
}

.notification-item[data-type="warning"].unread {
  background: linear-gradient(90deg, var(--notification-warning-alpha) 0%, transparent 100%);
}

.notification-item[data-type="error"] {
  border-left-color: var(--notification-error);
}

.notification-item[data-type="error"].unread {
  background: linear-gradient(90deg, var(--notification-error-alpha) 0%, transparent 100%);
}

.notification-item[data-type="info"] {
  border-left-color: var(--notification-info);
}

.notification-item[data-type="info"].unread {
  background: linear-gradient(90deg, var(--notification-info-alpha) 0%, transparent 100%);
}

/* Animation d'attention pour les notifications importantes */
.notification-bell.has-urgent {
  animation: urgentPulse 1.5s infinite;
}

@keyframes urgentPulse {
  0%, 100% { 
    background: var(--surface-variant);
    border-color: var(--border-color);
  }
  50% { 
    background: var(--error-alpha-20);
    border-color: var(--error);
  }
}

/* Effet de fade pour les notifications qui disparaissent */
.notification-item.fading {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* Styles pour les notifications de priorité différente */
.notification-item.priority-high .notification-icon {
  animation: highPriorityPulse 2s infinite;
}

@keyframes highPriorityPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.notification-item.priority-low {
  opacity: 0.9;
}

/* Style pour la sidebar compacte */
.sidebar.compact #notification-system {
  margin: 8px auto;
}

.sidebar.compact .notification-bell {
  width: 32px;
  height: 32px;
}

.sidebar.compact .bell-icon {
  font-size: 1em;
}

/* Préparation pour le mode sombre (déjà intégré avec les variables CSS) */
[data-theme="dark"] .notification-dropdown {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .notification-badge {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}