/**
 * ============================================
 * NOTIFICATION SERVICE - ESTILOS
 * ============================================
 * Estilos para toasts y componentes de notificación.
 * Sigue las convenciones del SDK SestIA.
 */

/* ============================================
   CONTENEDOR DE TOASTS
   ============================================ */
.notification-container {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  pointer-events: none;
  max-height: 100vh;
  overflow: hidden;
}

.notification-container.top-right {
  top: 0;
  right: 0;
}

.notification-container.top-left {
  top: 0;
  left: 0;
}

.notification-container.bottom-right {
  bottom: 0;
  right: 0;
}

.notification-container.bottom-left {
  bottom: 0;
  left: 0;
}

/* ============================================
   TOAST INDIVIDUAL
   ============================================ */
.notification-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  min-width: 320px;
  max-width: 420px;
  background: var(--panel, #1a1a1a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  position: relative;
  overflow: hidden;

  /* Animación de entrada */
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-container.top-left .notification-toast,
.notification-container.bottom-left .notification-toast {
  transform: translateX(-100%);
}

.notification-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-toast.hide {
  opacity: 0;
  transform: translateX(100%) scale(0.9);
}

.notification-container.top-left .notification-toast.hide,
.notification-container.bottom-left .notification-toast.hide {
  transform: translateX(-100%) scale(0.9);
}

/* ============================================
   ICONOS POR TIPO
   ============================================ */
.notification-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

.notification-toast.success .notification-icon {
  background: color-mix(in srgb, var(--success, #4caf50) 20%, transparent);
  color: var(--success, #4caf50);
}

.notification-toast.error .notification-icon {
  background: color-mix(in srgb, var(--danger, #f44336) 20%, transparent);
  color: var(--danger, #f44336);
}

.notification-toast.warning .notification-icon {
  background: color-mix(in srgb, var(--warning, #ff9800) 20%, transparent);
  color: var(--warning, #ff9800);
}

.notification-toast.info .notification-icon {
  background: color-mix(in srgb, var(--info, #2196f3) 20%, transparent);
  color: var(--info, #2196f3);
}

/* ============================================
   CONTENIDO
   ============================================ */
.notification-body {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #ffffff);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.notification-message {
  font-size: 0.8125rem;
  color: var(--muted, rgba(255, 255, 255, 0.6));
  line-height: 1.4;
  word-break: break-word;
}

/* ============================================
   BOTÓN CERRAR
   ============================================ */
.notification-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted, rgba(255, 255, 255, 0.5));
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #ffffff);
}

/* ============================================
   BARRA DE PROGRESO
   ============================================ */
.notification-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0 0 var(--radius-md, 12px) var(--radius-md, 12px);
  overflow: hidden;
}

.notification-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: var(--brand, #e53935);
  transform-origin: left;
  transform: scaleX(1);
}

.notification-progress.animate::after {
  animation: progressShrink linear forwards;
}

@keyframes progressShrink {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.notification-toast.success .notification-progress::after {
  background: var(--success, #4caf50);
}

.notification-toast.error .notification-progress::after {
  background: var(--danger, #f44336);
}

.notification-toast.warning .notification-progress::after {
  background: var(--warning, #ff9800);
}

.notification-toast.info .notification-progress::after {
  background: var(--info, #2196f3);
}

/* ============================================
   BORDE LATERAL POR TIPO
   ============================================ */
.notification-toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand, #e53935);
  border-radius: var(--radius-md, 12px) 0 0 var(--radius-md, 12px);
}

.notification-toast.success::before {
  background: var(--success, #4caf50);
}

.notification-toast.error::before {
  background: var(--danger, #f44336);
}

.notification-toast.warning::before {
  background: var(--warning, #ff9800);
}

.notification-toast.info::before {
  background: var(--info, #2196f3);
}

/* ============================================
   BOTÓN DE NOTIFICACIONES (para módulos)
   ============================================ */
.notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--panel, #1a1a1a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
  color: var(--text, #ffffff);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.notification-btn:hover {
  background: var(--hover, rgba(255, 255, 255, 0.05));
  border-color: var(--border-hover, rgba(255, 255, 255, 0.2));
}

.notification-btn svg {
  width: 18px;
  height: 18px;
  color: var(--muted, rgba(255, 255, 255, 0.6));
}

/* Badge de contador */
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger, #f44336);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
  display: none;
}

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

/* ============================================
   PANEL DE NOTIFICACIONES (dropdown)
   ============================================ */
.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--panel, #1a1a1a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 1000;

  /* Animación */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.notification-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}

.notification-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #ffffff);
}

.notification-panel-actions {
  display: flex;
  gap: 0.5rem;
}

.notification-panel-action {
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted, rgba(255, 255, 255, 0.6));
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.notification-panel-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #ffffff);
}

.notification-panel-body {
  max-height: 360px;
  overflow-y: auto;
}

.notification-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--muted, rgba(255, 255, 255, 0.5));
  text-align: center;
}

.notification-panel-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.notification-panel-empty p {
  font-size: 0.875rem;
}

/* Items en el panel */
.notification-panel-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.05));
  cursor: pointer;
  transition: background 0.2s;
}

.notification-panel-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.notification-panel-item.unread {
  background: rgba(229, 57, 53, 0.05);
}

.notification-panel-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand, #e53935);
}

.notification-panel-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

.notification-panel-item-content {
  flex: 1;
  min-width: 0;
}

.notification-panel-item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text, #ffffff);
  margin-bottom: 0.25rem;
}

.notification-panel-item-message {
  font-size: 0.75rem;
  color: var(--muted, rgba(255, 255, 255, 0.6));
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-panel-item-time {
  font-size: 0.6875rem;
  color: var(--muted, rgba(255, 255, 255, 0.4));
  margin-top: 0.25rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .notification-container {
    padding: 0.5rem;
    left: 0;
    right: 0;
  }

  .notification-toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .notification-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-md, 12px) var(--radius-md, 12px) 0 0;
  }
}
