/**
 * =========================================
 * DROPDOWN UNIVERSEL - MOBILE FIRST
 * Un seul dropdown pour notifications ET user profile
 * =========================================
 */

:root {
  --dropdown-bg-light: #ffffff;
  --dropdown-bg-dark: #2a2a2a;
  --dropdown-text-light: #1a1a1a;
  --dropdown-text-dark: #ffffff;
  --cherry: #e63946;
  --cherry-hover: #ff4d5a;
}

/* =========================================
   CONTENEUR PRINCIPAL
   ========================================= */
.universal-dropdown {
  position: fixed;
  top: 75px;
  left: 10px;
  right: 10px;
  background: var(--dropdown-bg-dark);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  overflow: hidden;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
}

.universal-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* =========================================
   VUES (Notifications et User Profile)
   ========================================= */
.dropdown-view {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.2s ease;
}

.dropdown-view.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================================
   HEADER DU DROPDOWN
   ========================================= */
.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.dropdown-header span {
  font-size: 14px;
  font-weight: 600;
  color: var(--dropdown-text-dark);
}

.mark-all-read {
  font-size: 12px;
  color: var(--cherry);
  text-decoration: none;
  transition: opacity 0.2s;
}

.mark-all-read:hover {
  opacity: 0.8;
}

/* =========================================
   CONTENU DU DROPDOWN
   ========================================= */
.dropdown-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  max-height: 400px;
}

/* Scrollbar mobile-first (fine sur mobile, visible sur desktop) */
.dropdown-content::-webkit-scrollbar {
  width: 4px;
}

.dropdown-content::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* =========================================
   NOTIFICATIONS
   ========================================= */
.dropdown-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  color: var(--dropdown-text-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
  position: relative;
}

.dropdown-notif-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-notif-item.unread {
  background: rgba(230, 57, 70, 0.08);
}

/* Lien cliquable dans la notification */
.notif-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.notif-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.notif-icon.success { background: rgba(40, 167, 69, 0.2); color: #28a745; }
.notif-icon.info { background: rgba(0, 123, 255, 0.2); color: #007bff; }
.notif-icon.warning { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.notif-icon.error { background: rgba(230, 57, 70, 0.2); color: #e63946; }

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 4px 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* Bouton de suppression - Bleu */
.notif-delete-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.dropdown-notif-item:hover .notif-delete-btn {
  opacity: 1;
}

.notif-delete-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  transform: translateY(-50%) scale(1.1);
}

.notif-delete-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* Message vide */
.dropdown-empty {
  padding: 40px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
}

.dropdown-empty i {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
}

.dropdown-empty p {
  margin: 0;
  font-size: 13px;
}

/* =========================================
   USER PROFILE VIEW
   ========================================= */

/* En-tête user avec avatar */
.dropdown-user-header-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  flex-shrink: 0;
}

.dropdown-user-header-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.dropdown-user-avatar,
.dropdown-user-avatar-initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.dropdown-user-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

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

.dropdown-user-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-user-info span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
}

.dropdown-profile-arrow {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

/* Dividers */
.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 0;
}

/* Section favoris */
.dropdown-section {
  padding: 12px 0;
}

.dropdown-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-count {
  margin-left: auto;
  background: rgba(230, 57, 70, 0.2);
  color: var(--cherry);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.dropdown-favorites-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-fav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--dropdown-text-dark);
  transition: background 0.2s;
}

.dropdown-fav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.fav-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.fav-title {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-city {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.dropdown-see-all {
  display: block;
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--cherry);
  text-decoration: none;
  font-weight: 500;
}

.dropdown-see-all:hover {
  text-decoration: underline;
}

/* Actions rapides */
.dropdown-menu-items {
  padding: 8px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.2s;
  font-size: 14px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

.dropdown-item.danger {
  color: #ff6b6b;
}

.dropdown-item.danger i {
  color: #ff6b6b;
}

/* =========================================
   FOOTER DU DROPDOWN
   ========================================= */
.dropdown-footer {
  padding: 12px 16px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.dropdown-footer a {
  font-size: 13px;
  color: var(--cherry);
  text-decoration: none;
  font-weight: 500;
}

.dropdown-footer a:hover {
  text-decoration: underline;
}

/* =========================================
   BOUTONS HEADER (Cloche & Avatar)
   ========================================= */
.header-icon-container {
  position: relative;
  margin-right: 8px;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-size: 20px;
}

.header-icon-btn:hover,
.header-icon-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.header-icon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--cherry);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.user-dropdown-trigger:hover,
.user-dropdown-trigger.active {
  background: rgba(255, 255, 255, 0.1);
}

.user-avatar,
.user-avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.dropdown-arrow {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  transition: transform 0.2s;
}

.user-dropdown-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* =========================================
   OVERLAY POUR FERMETURE
   ========================================= */
.dropdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.dropdown-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* =========================================
   RESPONSIVE - MOBILE FIRST
   ========================================= */

/* Tablette (768px+) */
@media (min-width: 768px) {
  .universal-dropdown {
    width: 340px;
    left: auto;
    right: 10px;
  }

  .dropdown-content {
    max-height: 420px;
  }

  .user-avatar,
  .user-avatar-initials {
    width: 38px;
    height: 38px;
  }
}

/* Desktop (976px+) */
@media (min-width: 976px) {
  .universal-dropdown {
    width: 360px;
    right: 15px;
    top: 80px;
  }

  .dropdown-header {
    padding: 16px 18px;
  }

  .dropdown-user-header-link {
    padding: 18px;
  }

  .dropdown-user-avatar,
  .dropdown-user-avatar-initials {
    width: 48px;
    height: 48px;
  }

  .dropdown-user-avatar-initials {
    font-size: 18px;
  }

  .dropdown-user-info strong {
    font-size: 15px;
  }

  .dropdown-user-info span {
    font-size: 12px;
  }

  /* Pas d'overlay sur desktop */
  .dropdown-overlay {
    display: none;
  }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .universal-dropdown {
    width: 380px;
  }
}
