/* ========================================
   POPUP DE BIENVENUE
   ======================================== */
.welcome-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.welcome-popup-overlay.visible {
  opacity: 1;
}

.welcome-popup {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.welcome-popup-overlay.visible .welcome-popup {
  transform: scale(1) translateY(0);
}

.welcome-popup-header {
  background: var(--accent-gradient);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  color: white;
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: wave 1s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}

.welcome-popup-header h2 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
}

.welcome-popup-header p {
  font-size: 1rem;
  margin: 0;
  opacity: 0.95;
  font-weight: 400;
}

.welcome-popup-body {
  padding: 2rem;
}

.welcome-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: inherit;
  outline: none;
}

.welcome-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: var(--bg-card);
}

.welcome-input::placeholder {
  color: var(--text-muted);
}

.welcome-hint {
  margin: 1rem 0 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
}

.welcome-popup-footer {
  padding: 0 2rem 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.welcome-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  min-width: 200px;
}

.welcome-btn-primary {
  background: var(--accent-gradient);
  color: white;
  opacity: 0.5;
  cursor: not-allowed;
}

.welcome-btn-primary.enabled {
  opacity: 1;
  cursor: pointer;
}

.welcome-btn-primary.enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.welcome-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.welcome-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.welcome-btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ========================================
   MESSAGE DE BIENVENUE
   ======================================== */
.greeting-message {
  position: fixed;
  top: 100px;
  right: 2rem;
 transform: translateX(calc(100% + 2rem)) translateY(0px);

  background: var(--bg-card);
  border: 2px solid var(--accent-primary);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90%;
}

.greeting-message.visible {
  opacity: 1;
  transform: translateX(calc(0%)) translateY(0px);

}

.greeting-icon {
  font-size: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

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

.greeting-text {
  font-size: 1rem;
  color: var(--text-primary);
}

.greeting-text strong {
  color: var(--accent-primary);
  font-weight: 700;
}

.greeting-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
}

.greeting-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========================================
   VISITE GUIDÉE - OVERLAY
   ======================================== */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9997;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tour-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ========================================
   VISITE GUIDÉE - SURBRILLANCE
   ======================================== */
.tour-highlight {
  position: relative ;
  z-index: 9999 !important;
  box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 8px rgba(102, 126, 234, 0.3) !important;
  border-radius: 12px !important;
  background: var(--accent-gradient) !important;
  animation: tourPulse 2s ease-in-out infinite;
  z-index: 9999 !important;
  border-radius: 0%;
}
.tour-highlight:not(.profile-toggle,.cards-grid){
  width: 55px;
  height: 55px;
}
.profile-toggle.tour-highlight{
  padding: 0.75rem 1.1rem !important;
}

/* Le header passe au-dessus de l'overlay quand il contient un élément en surbrillance */
header:has(.tour-highlight) {
  z-index: 9997 !important;
}

@keyframes tourPulse {
  0%, 100% {
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 8px rgba(102, 126, 234, 0.3) !important;
  }
  50% {
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 12px rgba(102, 126, 234, 0.5) !important;
  }
}

/* ========================================
   VISITE GUIDÉE - TOOLTIP
   ======================================== */
.tour-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 2px solid var(--accent-primary);
  border-radius: 16px;
  padding: 0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.tour-tooltip.visible {
  opacity: 1;
  transform: scale(1);
}

/* Flèche stylisée séparée */
.tour-arrow {
  position: absolute;
  width: 50px;
  height: 50px;
  z-index: -1;
}

.tour-arrow::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  animation: arrowPulse 2s ease-in-out infinite;
}

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

/* Position de la flèche selon l'orientation du tooltip */
.tour-tooltip-top .tour-arrow {
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.tour-tooltip-bottom .tour-arrow {
  top: -60px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.tour-tooltip-left .tour-arrow {
  right: -60px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.tour-tooltip-right .tour-arrow {
  left: -60px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.tour-tooltip-center .tour-arrow {
  top: -60px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

/* Sur desktop, la flèche center pointe vers la gauche */
@media (min-width: 769px) {
  .tour-tooltip-center .tour-arrow {
    left: -60px;
    top: 30%;
    transform: translateY(-50%) rotate(45deg);
  }
}

/* Sur mobile, centrer TOUTES les pop-ups */
@media (max-width: 768px) {
  .tour-tooltip-top,
  .tour-tooltip-bottom,
  .tour-tooltip-left,
  .tour-tooltip-right,
  .tour-tooltip-center {
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
  }
  
  .tour-tooltip-top.visible,
  .tour-tooltip-bottom.visible,
  .tour-tooltip-left.visible,
  .tour-tooltip-right.visible,
  .tour-tooltip-center.visible {
    transform: translate(-50%, -50%) scale(1) !important;
  }
  
  /* Toutes les flèches pointent vers le haut sur mobile */
  .tour-tooltip-top .tour-arrow,
  .tour-tooltip-bottom .tour-arrow,
  .tour-tooltip-left .tour-arrow,
  .tour-tooltip-right .tour-arrow,
  .tour-tooltip-center .tour-arrow {
    top: -60px;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translateX(-50%) rotate(45deg);
  }
}

.tour-tooltip-header {
  background: var(--accent-gradient);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.tour-tooltip-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
}

.tour-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.tour-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.tour-tooltip-body {
  padding: 1.5rem;
}

.tour-tooltip-body p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.tour-tooltip-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tour-progress {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.tour-progress span {
  color: var(--accent-primary);
  font-weight: 700;
}

.tour-buttons {
  display: flex;
  gap: 0.5rem;
}

.tour-btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tour-btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.tour-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tour-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.tour-btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .welcome-popup {
    max-width: 95%;
  }

  .welcome-popup-header {
    padding: 2rem 1.5rem 1.5rem;
  }

  .welcome-icon {
    font-size: 3rem;
  }

  .welcome-popup-header h2 {
    font-size: 1.5rem;
  }

  .welcome-popup-body {
    padding: 1.5rem;
  }

  .welcome-popup-footer {
    padding: 0 1.5rem 1.5rem;
    flex-direction: column;
  }

  .welcome-btn {
    width: 100%;
  }

  .greeting-message {
    top: 70px;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
  }

  .greeting-icon {
    font-size: 1.25rem;
  }

  .tour-tooltip {
    max-width: 95%;
  }

  .tour-tooltip-header h3 {
    font-size: 1.1rem;
  }

  .tour-tooltip-body {
    padding: 1.25rem;
  }

  .tour-tooltip-body p {
    font-size: 0.95rem;
  }

  .tour-tooltip-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .tour-buttons {
    width: 100%;
    flex-direction: column;
  }

  .tour-btn {
    width: 100%;
  }

  .tour-progress {
    text-align: center;
  }
}

/* ========================================
   VISITE GUIDÉE - SURBRILLANCE
   ======================================== */
.tour-highlight {
  position: relative ;
  z-index: 9999 !important;
  box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 8px rgba(102, 126, 234, 0.3) !important;
  border-radius: 12px !important;
  animation: tourPulse 2s ease-in-out infinite;
}

/* Le header passe au-dessus de l'overlay quand il contient un élément en surbrillance */
header:has(.tour-highlight) {
  z-index: 9999 !important;
}

@keyframes tourPulse {
  0%, 100% {
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 8px rgba(102, 126, 234, 0.3) !important;
  }
  50% {
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 0 12px rgba(102, 126, 234, 0.5) !important;
  }
}

/* ========================================
   CURSEUR ANIMÉ POUR LA VISITE GUIDÉE
   ======================================== */
.tour-cursor {
  position: fixed;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 10001;
  opacity: 1;
  display: block;
}

.tour-cursor.hidden {
  display: none;
}

.tour-cursor svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Animation de clic */
.tour-cursor-click {
  position: absolute;
  top: 50%;
  left: 50%;
  /* transform: translate(-50%, -50%); */
  width: 40px;
  height: 40px;
  border: 3px solid var(--accent-primary);
  border-radius: 50%;
  opacity: 0;
  animation: cursorClick 1.5s ease-out infinite;
}

@keyframes cursorClick {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* Animation de déplacement du curseur */
 @keyframes moveCursor {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(var(--cursor-x), var(--cursor-y));
  }
} 

.tour-tooltip-top.visible {
  animation: slideInFromBottom 0.3s ease-out;
}

.tour-tooltip-bottom.visible {
  animation: slideInFromTop 0.3s ease-out;
}

/* ========================================
   MENU PROFIL DANS LE HEADER
   ======================================== */
.header-profile {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}

.profile-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.profile-toggle svg {
  flex-shrink: 0;
}

.profile-name {
  white-space: nowrap;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.profile-dropdown.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.profile-dropdown.hidden {
  display: none;
}

.profile-dropdown-header {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--accent-gradient);
  border-radius: 14px 14px 0 0;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-avatar svg {
  color: white;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-greeting {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 0.25rem 0;
  font-weight: 500;
}

.profile-username {
  font-size: 1.1rem;
  color: white;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0;
}

.profile-dropdown-menu {
  padding: 0.5rem;
}

.profile-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
}

.profile-menu-item:hover {
  background: var(--bg-secondary);
  transform: translateX(4px);
}

.profile-menu-item svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.profile-menu-item:hover svg {
  color: var(--accent-primary);
}

.profile-menu-item-danger {
  color: #ef4444;
}

.profile-menu-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.profile-menu-item-danger svg {
  color: #ef4444;
}

.profile-menu-item-danger:hover svg {
  color: #dc2626;
}

@media (max-width: 768px) {
  .profile-toggle {
    padding: 0.5rem;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    justify-content: center;
  }
  
  .profile-name {
    display: none;
  }
  
  .profile-dropdown {
    min-width: 260px;
  }
}
