/* =========================================================
   SafePassInt — Modal de notificaciones
   ========================================================= */

#notificationModal {
  --notif-primary: #2563eb;
  --notif-primary-dark: #1d4ed8;
  --notif-success: #16a34a;
  --notif-danger: #ef4444;
  --notif-text: #0f172a;
  --notif-muted: #64748b;
  --notif-border: #dbe4f0;
  --notif-surface: #ffffff;
  --notif-surface-soft: #f8fafc;
  --notif-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}


/* =========================================================
   Estructura general
   ========================================================= */

#notificationModal .modal-dialog {
  width: min(92vw, 640px);
  max-width: 640px;
  margin: 1rem auto;
}

#notificationModal .modal-content {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.35rem;
  background: var(--notif-surface);
  box-shadow: var(--notif-shadow);
}

#notificationModal .modal-header {
  min-height: 82px;
  padding: 1.25rem 1.5rem;
  border: 0;
  background:
    linear-gradient(
      135deg,
      #1677ff 0%,
      #2563eb 55%,
      #4f46e5 100%
    );
}

#notificationModal .modal-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

#notificationModal .btn-close {
  width: 2rem;
  height: 2rem;
  padding: 0.35rem;
  margin: 0;
  border-radius: 50%;
  opacity: 0.9;
  transition:
    background-color 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

#notificationModal .btn-close:hover {
  background-color: rgba(255, 255, 255, 0.14);
  opacity: 1;
  transform: rotate(6deg);
}


/* =========================================================
   Cuerpo y scroll
   ========================================================= */

#notificationModal .modal-body {
  max-height: min(62vh, 620px);
  padding: 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(
      180deg,
      #f8fafc 0%,
      #f1f5f9 100%
    );
}

#notificationModal .modal-body::-webkit-scrollbar {
  width: 9px;
}

#notificationModal .modal-body::-webkit-scrollbar-track {
  background: transparent;
}

#notificationModal .modal-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #b8c4d6;
  background-clip: padding-box;
}

#notificationModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: padding-box;
}


/* =========================================================
   Tarjetas
   ========================================================= */

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: flex-start;

  margin-bottom: 0.9rem;
  padding: 1.05rem 1rem 1rem 1.15rem;

  border: 1px solid var(--notif-border);
  border-left: 5px solid #2997ff;
  border-radius: 1rem;

  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 8px 22px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(15, 23, 42, 0.05);

  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.notification-item:last-child {
  margin-bottom: 0;
}

.notification-item:hover {
  transform: translateY(-1px);
  border-color: #c8d5e5;
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.09),
    0 2px 6px rgba(15, 23, 42, 0.05);
}

.notification-item.read_status-true {
  opacity: 0.68;
  border-left-color: #94a3b8;
  background: rgba(248, 250, 252, 0.94);
}

.notification-item.notification-removing {
  opacity: 0.25;
  transform: translateX(12px);
  pointer-events: none;
}


/* =========================================================
   Contenido
   ========================================================= */

.notification-item .msg-wrapper {
  min-width: 0;
  padding-right: 0.25rem;
}

.notification-item p {
  margin: 0 0 0.45rem;
  color: var(--notif-text);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.notification-item small {
  display: block;
  color: var(--notif-muted);
  font-size: 0.8rem;
  font-weight: 500;
}


/* =========================================================
   Botones de acción
   ========================================================= */

.notification-item .action-btns {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
}

.notification-item .mark-btn,
.notification-item .delete-btn {
  position: static;
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;

  font-size: 1rem;
  line-height: 1;
  cursor: pointer;

  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.notification-item .mark-btn {
  color: var(--notif-success);
}

.notification-item .mark-btn:hover {
  border-color: rgba(22, 163, 74, 0.18);
  background: rgba(22, 163, 74, 0.1);
  transform: scale(1.06);
}

.notification-item .delete-btn {
  color: var(--notif-danger);
}

.notification-item .delete-btn:hover {
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.06);
}


/* =========================================================
   Footer
   ========================================================= */

#notificationModal .modal-footer {
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--notif-border);
  background: #ffffff;
}

#notificationModal .modal-footer .btn {
  min-height: 46px;
  border-radius: 0.75rem;
  font-weight: 700;
}

#notificationModal .modal-footer .btn-outline-secondary {
  border-color: #cbd5e1;
  color: #475569;
  background: #ffffff;
}

#notificationModal .modal-footer .btn-outline-secondary:hover {
  border-color: #94a3b8;
  color: #0f172a;
  background: #f8fafc;
}

#markAllAsReadBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  padding-inline: 1.2rem;
  border-color: var(--notif-success);
  background: var(--notif-success);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.18);

  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

#markAllAsReadBtn:hover {
  border-color: #15803d;
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.24);
}

#markAllAsReadBtn:disabled {
  opacity: 0.62;
  transform: none;
  box-shadow: none;
  cursor: wait;
}


/* =========================================================
   Estado vacío, carga y errores
   ========================================================= */

#notificationList > p {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.72);
}


/* =========================================================
   Tema oscuro
   ========================================================= */

html.dark-mode #notificationModal,
body.dark-mode #notificationModal {
  --notif-text: #f1f5f9;
  --notif-muted: #94a3b8;
  --notif-border: #334155;
  --notif-surface: #111827;
  --notif-surface-soft: #0f172a;
  --notif-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

html.dark-mode #notificationModal .modal-content,
body.dark-mode #notificationModal .modal-content {
  border-color: rgba(71, 85, 105, 0.56);
  background: #111827;
}

html.dark-mode #notificationModal .modal-header,
body.dark-mode #notificationModal .modal-header {
  border-bottom: 1px solid rgba(96, 165, 250, 0.22);
  background:
    linear-gradient(
      135deg,
      #0756d8 0%,
      #1d4ed8 52%,
      #3730a3 100%
    );
}

html.dark-mode #notificationModal .modal-body,
body.dark-mode #notificationModal .modal-body {
  background:
    radial-gradient(
      circle at top right,
      rgba(37, 99, 235, 0.08),
      transparent 40%
    ),
    #0f172a;

  scrollbar-color: #475569 #0f172a;
}

html.dark-mode .notification-item,
body.dark-mode .notification-item {
  border-color: #334155;
  border-left-color: #3b82f6;
  background: #1e293b;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 1px 3px rgba(0, 0, 0, 0.24);
}

html.dark-mode .notification-item:hover,
body.dark-mode .notification-item:hover {
  border-color: #475569;
  background: #223047;
}

html.dark-mode .notification-item.read_status-true,
body.dark-mode .notification-item.read_status-true {
  border-left-color: #475569;
  background: #182235;
  opacity: 0.62;
}

html.dark-mode .notification-item p,
body.dark-mode .notification-item p {
  color: #e5edf8;
}

html.dark-mode .notification-item small,
body.dark-mode .notification-item small {
  color: #94a3b8;
}

html.dark-mode #notificationModal .modal-footer,
body.dark-mode #notificationModal .modal-footer {
  border-top-color: #334155;
  background: #111827;
}

html.dark-mode #notificationModal .modal-footer .btn-outline-secondary,
body.dark-mode #notificationModal .modal-footer .btn-outline-secondary {
  border-color: #475569;
  color: #cbd5e1;
  background: #172033;
}

html.dark-mode #notificationModal .modal-footer .btn-outline-secondary:hover,
body.dark-mode #notificationModal .modal-footer .btn-outline-secondary:hover {
  border-color: #64748b;
  color: #ffffff;
  background: #1e293b;
}

html.dark-mode #notificationList > p,
body.dark-mode #notificationList > p {
  border-color: #334155;
  color: #94a3b8 !important;
  background: #172033;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 576px) {
  #notificationModal .modal-dialog {
    width: calc(100vw - 1rem);
    margin: 0.5rem auto;
  }

  #notificationModal .modal-content {
    max-height: calc(100vh - 1rem);
    border-radius: 1rem;
  }

  #notificationModal .modal-header {
    min-height: 70px;
    padding: 1rem;
  }

  #notificationModal .modal-title {
    font-size: 1.25rem;
  }

  #notificationModal .modal-body {
    max-height: calc(100vh - 210px);
    padding: 0.85rem;
  }

  .notification-item {
    gap: 0.7rem;
    padding: 0.9rem;
    border-radius: 0.85rem;
  }

  .notification-item p {
    font-size: 0.93rem;
  }

  #notificationModal .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 0.85rem;
  }

  #notificationModal .modal-footer .btn {
    width: 100%;
  }
}


/* =========================================================
   Accesibilidad
   ========================================================= */

.notification-item .mark-btn:focus-visible,
.notification-item .delete-btn:focus-visible,
#notificationModal .btn:focus-visible,
#notificationModal .btn-close:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}