/* ============================================
   VARIABLES
   ============================================ */
:root {
  --color1: #41ba0d;
  --color2: #5dcb2a;
  --color3: #79dd46;
  --color4: #95ee63;
  --color5: #b1ff7f;
  --color6: #000000;
  --color-blanco: #ffffff;
  --color-gris: #333;
  --color-rojo: #ff0000;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 0.375rem;
}

/* ============================================
   NOTIFICATION WRAPPER
   ============================================ */
.notification-wrapper {
  position: relative;
  display: inline-block;
}

/* ============================================
   CAMPANA DE NOTIFICACIONES
   ============================================ */
.notification-bell {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-blanco);
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
  z-index: 100;
}

@media (min-width: 769px) {
  .notification-bell {
    color: var(--color6);
  }
}

.notification-bell:hover {
  background-color: var(--color2);
}

.notification-bell svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.notification-bell p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  display: inline-block;
}

/* ============================================
   CONTADOR DE NOTIFICACIONES
   ============================================ */
.notification-count {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--color-rojo);
  color: var(--color-blanco);
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--color-blanco);
  padding: 0 4px;
  transform: translate(40%, -30%);
}

/* Badge móvil */
.mobile-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
}

.mobile-badge.pulse {
  animation: notificationPulse 0.5s ease-out;
}

@keyframes notificationPulse {
  0%, 100% {
    transform: scale(1);
    background-color: #ff4444;
  }
  50% {
    transform: scale(1.15);
    background-color: #ff6666;
  }
}

/* ============================================
   LISTA DE NOTIFICACIONES (DROPDOWN)
   ============================================ */
.notification-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  width: 350px;
  max-height: 400px;
  overflow-y: auto;
  background-color: var(--color-blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  z-index: 10000;
  text-align: left;
  border: 1px solid var(--color4);
}

/* Mostrar cuando tenga la clase show o cuando la campana esté activa */
.notification-dropdown.show,
.notification-wrapper .notification-bell.active + .notification-dropdown {
  display: block !important;
  animation: fadeInDown 0.3s ease forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   ENCABEZADO DEL DROPDOWN
   ============================================ */
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background-color: var(--color1);
  color: white;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.notification-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.close-notifications {
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: opacity 0.2s;
}

.close-notifications:hover {
  opacity: 0.8;
}

/* ============================================
   ITEMS DE NOTIFICACIÓN
   ============================================ */
#notification-items-container {
  padding: 8px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background-color: var(--color-blanco);
  transition: background-color 0.2s ease;
  text-decoration: none;
  color: var(--color-gris);
  border-left: 3px solid var(--color1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.notification-item:last-child {
  margin-bottom: 0;
}

.notification-item:hover {
  background-color: var(--color5);
}

.notification-thumbnail {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background-color: var(--color1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: var(--color-blanco);
}

.notification-content {
  flex-grow: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-gris);
}

/* ============================================
   NOTIFICACIÓN FLOTANTE (VALORACIONES)
   ============================================ */
.floating-notification {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 20px;
  max-width: 350px;
  z-index: 9999;
  animation: slideInRight 0.4s ease;
  border: 2px solid var(--color1);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.floating-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.floating-notification p {
  margin: 0;
  color: #333;
  font-size: 15px;
  line-height: 1.5;
}

.floating-actions {
  display: flex;
  gap: 10px;
}

.floating-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-action {
  background: linear-gradient(135deg, #41ba0d, #5dcb2a);
  color: white;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(65, 186, 13, 0.3);
}

.btn-close {
  background: #f0f0f0;
  color: #666;
}

.btn-close:hover {
  background: #e0e0e0;
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */
@media (min-width: 769px) {
  /* El dropdown funciona normalmente en desktop */
  .notification-dropdown {
    /* Estilos por defecto ya definidos arriba */
  }
}

/* ============================================
   RESPONSIVE - MÓVIL
   ============================================ */
@media (max-width: 768px) {
  /* CRÍTICO: Ocultar completamente el dropdown en móvil */
  .notification-dropdown {
    display: none !important;
  }
  
  /* Forzar que NUNCA se muestre en móvil, incluso con clase show */
  .notification-dropdown.show,
  .notification-wrapper .notification-bell.active + .notification-dropdown {
    display: none !important;
  }
  
  /* La campana móvil redirige, no abre dropdown */
  #mobile-notification-trigger {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(121, 221, 70, 0.2);
  }

  /* Hacer la campana más grande en móvil (si se usa) */
  .notification-bell svg {
    width: 24px;
    height: 24px;
  }

  /* Items más grandes para tocar fácilmente (para cuando se use en página) */
  .notification-item {
    padding: 15px;
    gap: 15px;
  }

  .notification-thumbnail {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  /* Notificación flotante en móvil */
  .floating-notification {
    left: 10px;
    right: 10px;
    bottom: 70px;
    max-width: none;
  }

  .floating-actions {
    flex-direction: column;
  }
}

/* ============================================
   PANTALLAS MUY PEQUEÑAS
   ============================================ */
@media (max-width: 380px) {
  .floating-notification {
    padding: 15px;
    bottom: 60px;
  }
  
  .floating-notification p {
    font-size: 14px;
  }
}