/* Notifications UI (Home + Admin)
   Centralized styles extracted from Blade templates.
   - Home selectors: .notification-dropdown*, .notification-bell*
   - Admin selectors: .notifications-menu*
*/

/* ---------- Shared Animations ---------- */
@keyframes notif-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes notif-badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes notif-badge-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@keyframes notif-bell-ring {
  0% { transform: rotate(0); }
  15% { transform: rotate(15deg); }
  30% { transform: rotate(-13deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-7deg); }
  75% { transform: rotate(4deg); }
  100% { transform: rotate(0); }
}

@keyframes notif-ripple {
  0%   { width: 0; height: 0; opacity: .35; }
  100% { width: 220%; height: 220%; opacity: 0; }
}

/* Prefers-reduced-motion safeguard */
@media (prefers-reduced-motion: reduce) {
  .notification-bell,
  .notification-dropdown__menu,
  .notification-dropdown__item,
  .notification-bell .ripple,
  .notification-bell .bx-bell,
  .notification-bell__badge,
  .notifications-menu .dropdown-menu,
  .notifications-menu__item,
  .notifications-menu .badge,
  .notifications-menu .nav-link .bx-bell {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Home Header Notifications ---------- */
.notification-bell {
  position: relative;
  border: none;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(14, 165, 233, 0.35));
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.35);
  overflow: hidden; /* for ripple */
}

.notification-bell::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification-bell:hover,
.notification-bell:focus-visible {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(14, 165, 233, 0.5));
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.45);
}

.notification-bell:hover::after,
.notification-bell:focus-visible::after {
  opacity: 1;
  transform: scale(1);
}

.notification-bell__badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: #f97316;
  color: #0f172a;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  padding: 0 5px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.35);
  transform-origin: center;
  animation: notif-badge-pop 260ms ease-out 1, notif-badge-pulse 2.4s ease-in-out 1.2s infinite;
}

.notification-bell.has-unread .bx-bell {
  animation: notif-bell-ring 1.4s ease-in-out 0.3s 2 both;
  transform-origin: 50% 0;
}

.notification-bell .ripple {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0; border-radius: 9999px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255,255,255,.35), transparent 70%);
  animation: notif-ripple 600ms ease-out forwards;
  pointer-events: none;
}

.notification-dropdown__menu {
  width: min(360px, 90vw);
  padding: 0;
  border-radius: 22px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 30px 60px rgba(2, 6, 23, 0.55);
  transform-origin: top right;
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.notification-dropdown .dropdown-menu.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.notification-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.notification-dropdown__header button { font-size: 0.85rem; }

.notification-dropdown__list {
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.35) transparent;
}
.notification-dropdown__list::-webkit-scrollbar { width: 8px; height: 8px; }
.notification-dropdown__list::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.35); border-radius: 20px; }

.notification-dropdown__item {
  display: flex;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  transition: background 0.18s ease, transform 0.18s ease;
  position: relative;
}
.notification-dropdown__item:last-child { border-bottom: 0; }
.notification-dropdown__item:hover { background: rgba(99, 102, 241, 0.09); transform: translateX(2px); }
.notification-dropdown__item.is-unread { background: rgba(99, 102, 241, 0.14); }

/* Accent bar */
.notification-dropdown__item::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(99,102,241,.8), rgba(14,165,233,.8));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 180ms ease;
  opacity: .7;
}
.notification-dropdown__item.is-unread::before,
.notification-dropdown__item:hover::before { transform: scaleY(1); }

.notification-dropdown__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.notification-dropdown__item:hover .notification-dropdown__icon { transform: scale(1.06); transition: transform 160ms ease; }

.notification-dropdown__icon--answer { background: rgba(14, 165, 233, 0.8); }
.notification-dropdown__icon--follow { background: rgba(236, 72, 153, 0.8); }
.notification-dropdown__icon--new-question { background: rgba(99, 102, 241, 0.85); }
.notification-dropdown__icon--default { background: rgba(148, 163, 184, 0.5); }

.notification-dropdown__content { flex: 1; }
.notification-dropdown__message { margin: 0; font-weight: 600; color: #f8fafc; }
.notification-dropdown__excerpt { margin: 0.4rem 0 0; font-size: 0.85rem; color: rgba(226, 232, 240, 0.78); }
.notification-dropdown__time { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.45rem; font-size: 0.78rem; color: rgba(148, 163, 184, 0.9); }
.notification-dropdown__empty { padding: 1.5rem; text-align: center; color: rgba(226, 232, 240, 0.75); }

/* Staggered reveal */
.notification-dropdown .dropdown-menu.show .notification-dropdown__item { animation: notif-fade-in 220ms ease both; }
.notification-dropdown .dropdown-menu.show .notification-dropdown__item:nth-child(1) { animation-delay: 40ms; }
.notification-dropdown .dropdown-menu.show .notification-dropdown__item:nth-child(2) { animation-delay: 80ms; }
.notification-dropdown .dropdown-menu.show .notification-dropdown__item:nth-child(3) { animation-delay: 120ms; }
.notification-dropdown .dropdown-menu.show .notification-dropdown__item:nth-child(4) { animation-delay: 160ms; }
.notification-dropdown .dropdown-menu.show .notification-dropdown__item:nth-child(5) { animation-delay: 200ms; }


/* ---------- Admin Header Notifications ---------- */
.notifications-menu .dropdown-menu {
  border-radius: 18px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.3);
  overflow: hidden;
  transform-origin: top right;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 200ms ease;
}
.notifications-menu .dropdown-menu.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.35);
}

.notifications-menu__header {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notifications-menu__list {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.35) transparent;
}
.notifications-menu__list::-webkit-scrollbar { height: 8px; width: 8px; }
.notifications-menu__list::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.35); border-radius: 20px; }

.notifications-menu__item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  position: relative;
  transition: background 160ms ease, transform 160ms ease;
  animation: notif-fade-in 220ms ease both;
}
.notifications-menu__item:last-child { border-bottom: 0; }
.notifications-menu__item.is-unread { background: rgba(99, 102, 241, 0.08); }
.notifications-menu__item:hover { background: rgba(99, 102, 241, 0.12); transform: translateX(2px); }

.notifications-menu__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.15);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.notifications-menu__item:hover .notifications-menu__icon { transform: scale(1.06); box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25); }

.notifications-menu__content p { margin: 0; font-weight: 600; }
.notifications-menu__time { font-size: 0.78rem; color: #6b7280; }
.notifications-menu__empty { padding: 1rem; text-align: center; color: #6b7280; }

/* Badge + bell animations for admin */
.notifications-menu .badge {
  transform-origin: center;
  animation: notif-badge-pop 260ms ease-out 1, notif-badge-pulse 2.2s ease-in-out 1.2s infinite;
}
.notifications-menu .nav-link.has-unread .bx-bell {
  animation: notif-bell-ring 1.4s ease-in-out 0.3s 2 both;
  transform-origin: 50% 0;
}

/* Staggered list appearance */
.notifications-menu__list > *:nth-child(1) { animation-delay: 40ms; }
.notifications-menu__list > *:nth-child(2) { animation-delay: 80ms; }
.notifications-menu__list > *:nth-child(3) { animation-delay: 120ms; }
.notifications-menu__list > *:nth-child(4) { animation-delay: 160ms; }
.notifications-menu__list > *:nth-child(5) { animation-delay: 200ms; }

