/* ============================================================
   Notification row — shared skeleton + per-family accent
   ------------------------------------------------------------
   Usage:
     <link rel="stylesheet" href="{% static 'notifs/notifs.css' %}">
     {% include "notifs/_row.html" with n=notification %}
   ============================================================ */

.notif-row {
  --notif-accent: #6b7280;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--notif-accent);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: transparent;
  transition: background-color .15s ease, transform .15s ease;
  position: relative;
}
.notif-row + .notif-row { margin-top: 4px; }
.notif-row:hover { background: rgba(0, 0, 0, 0.04); }
.notif-row:active { transform: scale(.995); }

.notif-row.is-unread { background: rgba(59, 130, 246, 0.06); }
.notif-row.is-unread::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  transform: translateY(-50%);
}

/* Avatar */
.notif-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  background: #e5e7eb;
}
.notif-avatar--icon {
  background: var(--notif-accent);
  color: #ffffff;
  font-size: 1rem;
}
.notif-avatar--icon i { line-height: 1; }

/* Body */
.notif-body {
  flex: 1 1 auto;
  min-width: 0;
}
.notif-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  color: #111827;
  word-break: break-word;
}
.notif-text {
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.35;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-time {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 4px;
}

/* Family-specific touches (optional flourishes) */

/* At-risk pulses gently to draw attention */
.notif-row[style*="#ef4444"] .notif-avatar--icon i,
.notif-row.notif-row--streak .notif-avatar--icon i.fa-fire {
  animation: notif-pulse 1.8s ease-in-out infinite;
}
@keyframes notif-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}

/* Rank promotion gets a subtle gradient backdrop */
.notif-row--rank.is-unread {
  background: linear-gradient(135deg,
              rgba(245, 158, 11, 0.10) 0%,
              rgba(59, 130, 246, 0.04) 100%);
}

/* Payment failures get a thicker accent border */
.notif-row[style*="#ef4444"] { border-left-width: 4px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .notif-row,
  .notif-row .notif-avatar--icon i {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   Dropdown shell (used by /notifs/dropdown)
   ============================================================ */
.notifs-dropdown {
  width: 360px;
  max-width: 92vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
.notifs-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f1f4;
}
.notifs-dropdown__title {
  font-weight: 700;
  font-size: 0.95rem;
}
.notifs-dropdown__mark-all {
  border: 0;
  background: transparent;
  color: #3b82f6;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.notifs-dropdown__mark-all:hover { text-decoration: underline; }
.notifs-dropdown__list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.4rem 0.4rem;
}
.notifs-dropdown__empty {
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
  padding: 2rem 1rem;
}
.notifs-dropdown__footer {
  display: block;
  text-align: center;
  padding: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3b82f6;
  text-decoration: none;
  border-top: 1px solid #f1f1f4;
  background: #fafbfc;
}
.notifs-dropdown__footer:hover { background: #f3f4f6; }

/* Highlighted "view all" footer */
.notifs-dropdown__footer--highlight {
  color: #ffffff;
  background: #3b82f6;
  font-weight: 700;
  letter-spacing: .01em;
}
.notifs-dropdown__footer--highlight:hover {
  background: #2563eb;
  color: #ffffff;
}

/* ============================================================
   Notification preset selector (Tout / Essentiel / Minimum)
   ============================================================ */
.notifs-dropdown__prefs {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #f1f1f4;
  background: #fafbfc;
}
.notif-prefs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: #eef0f3;
}
.notif-prefs__opt {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.notif-prefs__opt:hover { color: #111827; }
.notif-prefs__opt.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.dark-mode .notifs-dropdown__prefs { background: transparent; border-color: rgba(255,255,255,.08); }
.dark-mode .notif-prefs { background: rgba(255, 255, 255, 0.08); }
.dark-mode .notif-prefs__opt { color: #9ca3af; }
.dark-mode .notif-prefs__opt:hover { color: #f3f4f6; }
.dark-mode .notif-prefs__opt.is-active { background: #374151; color: #f3f4f6; }

/* ============================================================
   Bell trigger button — modern, colored, animated
   ============================================================ */
.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #3b82f6;
  text-decoration: none;
  transition: transform .2s ease;
}
.notif-bell-btn:hover { transform: translateY(-1px); }
.notif-bell-btn i { font-size: 1.45rem; line-height: 1; }
.notif-bell-btn .notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid #212529;
}
.notif-bell-btn.has-unread i {
  animation: bellShake 1.2s ease-in-out;
  animation-iteration-count: 2;
  transform-origin: top center;
}
@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-12deg); }
  30% { transform: rotate(10deg); }
  45% { transform: rotate(-8deg); }
  60% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}
@media (prefers-reduced-motion: reduce) {
  .notif-bell-btn.has-unread i { animation: none; }
}

/* Dark variant — opt-in only via an explicit .dark-mode ancestor.
   (The dropdown/inbox shells use light backgrounds, so we must NOT
   react to the OS prefers-color-scheme, or titles turn grey on white.) */
.dark-mode .notif-row:hover { background: rgba(255, 255, 255, 0.05); }
.dark-mode .notif-row.is-unread { background: rgba(59, 130, 246, 0.12); }
.dark-mode .notif-title { color: #f3f4f6; }
.dark-mode .notif-text  { color: #9ca3af; }
.dark-mode .notif-time  { color: #6b7280; }
