/* ============================================================
   SKYFUNS NOTIFICATIONS — Final Version Polished (with tweaks)
   ============================================================ */

/* Container */
body {
  font-family: "Inter", "Segoe UI", sans-serif;
}

.sf-notifications {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1.5rem, 5vw, 3rem);
  display: grid;
  gap: 1.8rem;
  color: var(--text-primary);
  animation: fadeIn 0.6s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HEADER
   ============================================================ */
.sf-notifications__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.4rem;
}

.sf-notifications__eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.sf-notifications__title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0.3rem 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.sf-notifications__subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ============================================================
   FILTERS
   ============================================================ */
.sf-notifications__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.sf-chip {
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sf-chip.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

.sf-chip:hover {
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-elevated));
}

/* ============================================================
   LOADING & EMPTY
   ============================================================ */
.sf-notifications__loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  justify-content: center;
  padding: 1rem 0;
}

.sf-notifications__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
  border-top-color: var(--accent-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sf-notifications__empty {
  text-align: center;
  padding: clamp(2rem, 5vw, 3rem);
  border-radius: 16px;
  border: 1px dashed color-mix(in srgb, var(--accent-primary) 35%, transparent);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  display: grid;
  gap: 0.8rem;
  justify-items: center;
  color: var(--text-secondary);
  animation: fadeIn 0.6s ease both;
}

.sf-notifications__empty i {
  width: 36px;
  height: 36px;
  color: var(--accent-primary);
}

/* ============================================================
   LIST
   ============================================================ */
.sf-notifications__list {
  display: grid;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ============================================================
   NOTIFICATION CARD
   ============================================================ */
.sf-notification {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "avatar body actions";
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--shadow-primary) 25%, transparent);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  opacity: 0;
  animation: slideUp 0.4s ease both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* UNREAD: colorful background */
.sf-notification.is-unread {
  /* background: color-mix(in srgb, var(--bg-elevated) 92%, transparent); */
  border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-light));
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent-primary) 60%, transparent);
}

.sf-notification:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--shadow-primary) 40%, transparent);
}

/* ============================================================
   AVATAR (round)
   ============================================================ */
.sf-notification__avatar {
  grid-area: avatar;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ============================================================
   BODY
   ============================================================ */
.sf-notification__body {
  grid-area: body;
  overflow: hidden;
}

.sf-notification__body h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* When expanded, allow full wrap to read long content */
.sf-notification.is-expanded .sf-notification__body h2 {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.sf-notification__body h2 strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.sf-notification__body time {
  display: block;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* ============================================================
   ACTIONS
   ============================================================ */
.sf-notification__actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.sf-notification__actions .sf-chip {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sf-notification__actions .sf-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Optional visual cue for read/unread icon states (lucide) */
.sf-notification.is-unread .sf-notification__actions [data-lucide="mail"],
.sf-notification.is-unread [data-lucide="mail"] {
  /* closed envelope when unread - JS sets the icon; this only ensures visibility if you want */
  opacity: 1;
}
.sf-notification:not(.is-unread) [data-lucide="mail-open"] {
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .sf-notification {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "avatar body"
      "actions actions";
    gap: 0.75rem 1rem;
  }

  .sf-notification__actions {
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .sf-notification__body h2 {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.sf-button {
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sf-button:hover {
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--border-light));
  color: var(--accent-primary);
}

.sf-button:active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

.sf-button.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

/* Danger style (Delete all) */
.sf-button.danger {
  border-color: #ef4444;
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 8%, #fff);
}
.sf-button.danger:hover {
  background: color-mix(in srgb, #ef4444 14%, #fff);
  color: #b91c1c;
  border-color: #ef4444;
}

/* ============================================================
   TOASTS — floating popup notifications
   ============================================================ */
.sf-toast-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: grid;
  gap: 0.7rem;
  z-index: 9999;
}

.sf-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 30%, var(--border-light));
  border-left: 4px solid var(--accent-primary);
  border-radius: 16px;
  padding: 0.8rem 1rem;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-primary, #000) 25%, transparent);
  color: var(--text-primary);
  animation: fadeIn 0.4s ease;
}

.sf-toast i {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--accent-primary);
}

.sf-toast.is-leaving {
  opacity: 0;
  transform: translateY(10px);
  transition: 0.25s ease;
}

/* Actions bar layout: left group + right group */
.sf-notifications__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sf-actions-left,
.sf-actions-right {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

/* Danger (Delete all) keeps to the right and looks destructive */
.sf-button.danger {
  border-color: #ef4444;
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 8%, #fff);
}
.sf-button.danger:hover {
  background: color-mix(in srgb, #ef4444 14%, #fff);
  color: #b91c1c;
  border-color: #ef4444;
}

/* Ensure avatar stays round even if images are odd sizes */
.sf-notification__avatar,
.sf-notification__avatar img {
  border-radius: 50%;
}

/* Horizontal action buttons inside the notification card */
.sf-notification__actions {
  grid-area: actions;
  display: flex;
  flex-direction: row;       /* was column */
  flex-wrap: wrap;           /* wrap on small widths */
  align-items: center;
  justify-content: flex-end; /* push to the right side of the card */
  gap: 0.45rem;
}

/* On small screens we keep row + wrap (already good) */
@media (max-width: 720px) {
  .sf-notification {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "avatar body"
      "actions actions";
  }
  .sf-notification__actions {
    justify-content: flex-start; /* align with text on mobile */
  }
}

/* ============================================================
   MODAL — Confirmation Dialog
   ============================================================ */
.sf-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #000 50%, transparent);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.sf-modal-overlay[hidden] {
  display: none;
}

.sf-modal {
  background: var(--bg-elevated, #fff);
  border-radius: 16px;
  max-width: 480px;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 60px color-mix(in srgb, #000 30%, transparent);
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sf-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.sf-modal__header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary, #111827);
}

.sf-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--text-secondary, #6b7280);
  transition: all 0.2s ease;
}

.sf-modal__close:hover {
  background: color-mix(in srgb, var(--accent-primary, #3b82f6) 10%, transparent);
  color: var(--accent-primary, #3b82f6);
}

.sf-modal__body {
  padding: 1.5rem;
  color: var(--text-secondary, #6b7280);
  line-height: 1.6;
}

.sf-modal__body p {
  margin: 0 0 1rem;
}

.sf-modal__body p:last-child {
  margin-bottom: 0;
}

.sf-modal__body strong {
  color: var(--text-primary, #111827);
  font-weight: 600;
}

.sf-modal__warning {
  color: #ef4444;
  font-size: 0.9rem;
  font-weight: 500;
}

.sf-modal__footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border-light, #e5e7eb);
}

.sf-modal__footer .sf-button {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Focus trap and keyboard accessibility */
.sf-modal-overlay:not([hidden]) {
  animation: fadeIn 0.2s ease;
}

.sf-modal button:focus-visible {
  outline: 2px solid var(--accent-primary, #3b82f6);
  outline-offset: 2px;
}


