/**
 * Header Styles
 * Styles pour le header avec boutons de thème et profil utilisateur
 * Inspiré de la maquette 4 (maquettes/maquette-4-analytics.html)
 */

/* Header Right Container */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Icon Buttons (Theme + Logout) */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-tertiary, #334155);
  border: none;
  color: var(--text-primary, #f1f5f9);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover, #475569);
  transform: scale(1.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Theme Button Active State */
.theme-btn.active {
  background: var(--accent-blue, #3b82f6);
  color: white;
  box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent-blue);
}

.theme-btn.active:hover {
  background: #2563eb;
}

/* Logout Button Specific */
.logout-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Auth Buttons (text-based login/logout) */
.btn-auth {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-login {
  background: var(--accent-blue, #3b82f6);
  color: white;
}

.btn-login:hover {
  background: #2563eb;
  transform: scale(1.02);
}

.btn-logout {
  background: var(--bg-tertiary, #334155);
  color: var(--text-secondary, #94a3b8);
}

.btn-logout:hover {
  background: #7f1d1d;
  color: #fecaca;
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-tertiary, #334155);
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.user-menu:hover {
  background: var(--bg-hover, #475569);
}

/* User Avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue, #3b82f6), var(--accent-purple, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

/* User Info */
.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* Pour permettre le text-overflow */
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Logout Button in User Menu */
.user-menu .logout-btn {
  margin-left: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
  .user-info {
    display: none; /* Masquer le nom sur tablette */
  }
  
  .user-menu {
    padding: 8px;
  }
}

@media (max-width: 768px) {
  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .header-right {
    gap: 12px;
  }
  
  /* Masquer certains boutons de thème sur mobile */
  .theme-btn:not(.active) {
    display: none;
  }
}

/* Animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Notification */
.notification {
  animation: slideIn 0.3s ease;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .icon-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .icon-btn:hover {
  background: var(--bg-hover);
}

[data-theme="dark"] .user-menu {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .user-menu:hover {
  background: var(--bg-hover);
}

[data-theme="dark"] .logout-btn:hover {
  background: #7f1d1d;
  color: #fecaca;
}

[data-theme="dark"] .btn-logout {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-logout:hover {
  background: #7f1d1d;
  color: #fecaca;
}

/* Light Mode Adjustments */
[data-theme="light"] .icon-btn {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .icon-btn:hover {
  background: #e2e8f0;
}

[data-theme="light"] .user-menu {
  background: #f1f5f9;
}

[data-theme="light"] .user-menu:hover {
  background: #e2e8f0;
}

[data-theme="light"] .logout-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

[data-theme="light"] .btn-logout {
  background: #f1f5f9;
  color: #475569;
}

[data-theme="light"] .btn-logout:hover {
  background: #fee2e2;
  color: #ef4444;
}

[data-theme="light"] .btn-login {
  background: #3b82f6;
  color: white;
}

/* Contrast Mode Adjustments */
[data-theme="contrast"] .icon-btn {
  background: #1a1a1a;
  border: 2px solid #ffffff;
  color: #ffffff;
}

[data-theme="contrast"] .icon-btn:hover {
  background: #2d2d2d;
  border-color: #4da6ff;
}

[data-theme="contrast"] .theme-btn.active {
  background: #4da6ff;
  border-color: #4da6ff;
  color: #000000;
}

[data-theme="contrast"] .user-menu {
  background: #1a1a1a;
  border: 2px solid #ffffff;
}

[data-theme="contrast"] .user-menu:hover {
  background: #2d2d2d;
  border-color: #4da6ff;
}

[data-theme="contrast"] .logout-btn:hover {
  background: #2d2d2d;
  border-color: #ff4d4d;
  color: #ff4d4d;
}

[data-theme="contrast"] .user-name,
[data-theme="contrast"] .user-role {
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}
