/* ═══════════════════════════════════════════════════════════════════
   BUFATTY · NOTIFICATIONS v4 · Modern (Linear/Notion-inspired)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Página ─── */
.notif-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}

@media (max-width: 640px) {
  .notif-page {
    padding: 24px 16px 80px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════ */
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.notif-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.notif-header h1 {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.9px;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.1;
}

.notif-header-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 9px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.35);
}

.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.notif-mark-all,
.notif-delete-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.notif-mark-all {
  color: var(--text-secondary);
}

.notif-mark-all:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notif-delete-all {
  color: var(--text-secondary);
}

.notif-delete-all:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger, #ef4444);
}

.notif-delete-all:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.notif-mark-all svg,
.notif-delete-all svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  flex-shrink: 0;
}

.notif-mark-all:active,
.notif-delete-all:active {
  transform: scale(0.97);
}

/* ═══════════════════════════════════════════════════════════════════
   SECCIONES POR FECHA · chips
   ═══════════════════════════════════════════════════════════════════ */
.notif-section {
  margin-bottom: 40px;
}

.notif-section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px 4px;
  padding: 0;
}

.notif-section-title::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--border-color);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════
   LISTA + ITEM
   ═══════════════════════════════════════════════════════════════════ */
.notif-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(6px);
  animation: notifItemIn 0.4s ease forwards;
}

@keyframes notifItemIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notif-item:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.04));
}

html[data-theme="light"] .notif-item:hover {
  background: rgba(0, 0, 0, 0.025);
}

/* ─── Unread: fondo ultra sutil ─── */
.notif-item.is-unread {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.055) 0%,
    rgba(124, 92, 255, 0.018) 70%,
    transparent 100%
  );
}

html[data-theme="light"] .notif-item.is-unread {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.05) 0%,
    rgba(124, 92, 255, 0.015) 70%,
    transparent 100%
  );
}

.notif-item.is-unread:hover {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.09) 0%,
    rgba(124, 92, 255, 0.03) 70%,
    transparent 100%
  );
}

/* ─── Unread dot ─── */
.notif-item .notif-unread-dot {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 3px var(--bg-page),
    0 0 12px rgba(124, 92, 255, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.notif-item.is-unread .notif-unread-dot {
  opacity: 1;
}

/* ─── Avatar ─── */
.notif-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--gradient-brand, linear-gradient(135deg, #7c5cff, #ff6ba8));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notif-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.notif-item.is-unread .notif-avatar {
  box-shadow:
    0 0 0 2px var(--bg-page),
    0 0 0 4px rgba(124, 92, 255, 0.35);
}

.notif-avatar:hover {
  transform: scale(1.06);
}

.notif-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Cuerpo ─── */
.notif-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-text {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.notif-actor {
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.notif-actor:hover {
  color: var(--accent);
}

.notif-action {
  color: var(--text-secondary);
  font-weight: 400;
}

.notif-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.1px;
}

/* ─── Icono por tipo · chip ─── */
.notif-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.notif-icon::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.15;
  pointer-events: none;
}

.notif-icon svg {
  width: 11px;
  height: 11px;
  position: relative;
  z-index: 1;
}

.notif-icon--like {
  background: rgba(254, 44, 85, 0.12);
  color: #FE2C55;
}
.notif-icon--like svg {
  fill: currentColor;
}

.notif-icon--comment {
  background: rgba(124, 92, 255, 0.14);
  color: #7c5cff;
}
.notif-icon--comment svg {
  fill: currentColor;
}

.notif-icon--follow,
.notif-icon--sub {
  background: rgba(52, 198, 125, 0.14);
  color: #34C67D;
}

.notif-icon--message {
  background: rgba(124, 92, 255, 0.14);
  color: #7c5cff;
}

.notif-icon--jury,
.notif-icon--moderation,
.notif-icon--resolved {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

/* Light theme */
html[data-theme="light"] .notif-icon--like {
  background: rgba(254, 44, 85, 0.1);
  color: #E94D8A;
}
html[data-theme="light"] .notif-icon--comment,
html[data-theme="light"] .notif-icon--message {
  background: rgba(124, 92, 255, 0.1);
  color: #5A3CE6;
}
html[data-theme="light"] .notif-icon--follow,
html[data-theme="light"] .notif-icon--sub {
  background: rgba(31, 138, 86, 0.1);
  color: #1F8A56;
}

/* ═══════════════════════════════════════════════════════════════════
   PREVIEW · thumbnail moderno
   ═══════════════════════════════════════════════════════════════════ */
.notif-preview {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="dark"] .notif-preview {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.notif-preview:hover {
  transform: scale(1.06);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    0 6px 18px rgba(0, 0, 0, 0.12);
}

.notif-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.notif-preview-text {
  padding: 4px 6px;
  font-size: 9.5px;
  line-height: 1.25;
  text-align: center;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.notif-preview-text--empty {
  font-size: 20px;
  -webkit-line-clamp: 1;
  color: var(--text-muted);
}

.notif-preview-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  display: grid;
  place-items: center;
}

.notif-preview-badge svg {
  width: 7px;
  height: 7px;
  margin-left: 1px;
}

/* Preview acción (Ver chat / Renovar / Votar) */
.notif-preview--action {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 10.5px;
  text-align: center;
}

.notif-preview--action .notif-preview-text {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 10.5px;
  -webkit-line-clamp: 2;
  line-height: 1.15;
  letter-spacing: -0.1px;
}

.notif-preview--action:hover {
  background: var(--accent-soft);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 6px 18px rgba(124, 92, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   BOTÓN × ELIMINAR
   ═══════════════════════════════════════════════════════════════════ */
.notif-delete-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%) scale(0.85);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.15s ease,
              color 0.15s ease, transform 0.2s ease;
  z-index: 5;
}

.notif-delete-btn svg {
  width: 12px;
  height: 12px;
}

.notif-item:hover .notif-delete-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.notif-delete-btn:hover {
  background: var(--danger, #ef4444);
  border-color: var(--danger, #ef4444);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}

/* Mobile: siempre visibles en tap */
@media (hover: none) {
  .notif-delete-btn {
    opacity: 0;
    pointer-events: none;
  }
  .notif-item:focus-within .notif-delete-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════ */
.notif-empty {
  text-align: center;
  padding: 100px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.notif-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft, rgba(124, 92, 255, 0.08));
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: 6px;
}

.notif-empty-icon svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.5;
}

.notif-empty-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0;
  color: var(--text-primary);
}

.notif-empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0;
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGINACIÓN
   ═══════════════════════════════════════════════════════════════════ */
.notif-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border-color-soft);
  color: var(--text-muted);
  font-size: 13px;
}

.notif-pagination a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.notif-pagination a:hover {
  color: var(--accent-hover);
}

/* ═══════════════════════════════════════════════════════════════════
   ALERTAS DE SEGURIDAD (mantiene estilo)
   ═══════════════════════════════════════════════════════════════════ */
.security-alerts-section {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color-soft);
}

.security-alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.security-alerts-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.security-alerts-title h2 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0;
}

.security-alerts-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.security-alerts-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 100px;
  background: var(--danger);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.security-alerts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.security-alert {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--warning);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.security-alert:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.security-alert-low    { border-left-color: var(--text-muted); }
.security-alert-medium { border-left-color: var(--warning); }
.security-alert-high   { border-left-color: var(--danger); }

.security-alert.is-unread {
  background: color-mix(in srgb, var(--bg-card) 95%, var(--accent-soft));
}

.security-alert-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
}

.security-alert-icon svg { width: 18px; height: 18px; }

.security-alert-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.security-alert-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.security-alert-kind { color: var(--text-muted); }

.security-alert-severity {
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
}

.security-alert-high .security-alert-severity {
  background: var(--danger-soft);
  color: var(--danger);
}

.security-alert-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--text-primary);
}

.security-alert-message {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.security-alert-actions {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.security-alert-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.security-alert-link:hover { color: var(--accent-hover); }

.security-alert-resolve {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.security-alert-resolve:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   STAGGER · animación en cascada para los items
   ═══════════════════════════════════════════════════════════════════ */
.notif-item:nth-child(1) { animation-delay: 0.02s; }
.notif-item:nth-child(2) { animation-delay: 0.05s; }
.notif-item:nth-child(3) { animation-delay: 0.08s; }
.notif-item:nth-child(4) { animation-delay: 0.11s; }
.notif-item:nth-child(5) { animation-delay: 0.14s; }
.notif-item:nth-child(6) { animation-delay: 0.17s; }
.notif-item:nth-child(7) { animation-delay: 0.20s; }
.notif-item:nth-child(8) { animation-delay: 0.23s; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .notif-header h1 { font-size: 24px; letter-spacing: -0.6px; }
  .notif-header-count { min-width: 22px; height: 22px; font-size: 11.5px; }
  .notif-mark-all,
  .notif-delete-all { padding: 7px 10px; font-size: 12px; }
  .notif-mark-all span,
  .notif-delete-all span { display: none; }
  .notif-item { padding: 10px 12px; gap: 10px; border-radius: 12px; }
  .notif-avatar { width: 40px; height: 40px; font-size: 14px; }
  .notif-preview { width: 44px; height: 44px; }
  .notif-text { font-size: 13px; }
  .notif-time { font-size: 11.5px; }
  .notif-section { margin-bottom: 28px; }
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCE MOTION
   ═══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .notif-item,
  .notif-avatar,
  .notif-preview,
  .notif-actor,
  .notif-delete-btn,
  .security-alert {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}