/* =============================================================================
   notifications.css — Phase 6: Receipts & Notifications
   Zap Design System
   All notification bell, panel, items, receipt buttons, push prompt styles.
   No inline styles anywhere — every state is class-driven.
   ============================================================================= */


/* ─── NOTIFICATION BELL ─────────────────────────────────────────────────────── */

.notif-bell-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.notif-bell-btn:hover {
  background: var(--bg-hover);
}

.notif-bell-btn:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
}

.notif-bell-icon {
  width: 22px;
  height: 22px;
  display: block;
  /* SVG tinted to match --text-secondary via filter */
  filter: brightness(0) invert(0.6);
  pointer-events: none;
  transition: filter 0.15s ease;
}

.notif-bell-btn:hover .notif-bell-icon,
.notif-bell-btn[aria-expanded="true"] .notif-bell-icon {
  filter: brightness(0) invert(0.9);
}

/* Unread badge */
.notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: var(--font-semi);
  line-height: 16px;
  text-align: center;
  border-radius: var(--radius-full);
  pointer-events: none;
  /* Hidden by default — JS adds .visible */
  display: none;
}

.notif-badge.visible {
  display: block;
}


/* ─── PANEL OVERLAY ──────────────────────────────────────────────────────────── */

.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.notif-overlay.open {
  opacity: 1;
  pointer-events: all;
}


/* ─── SLIDE-IN PANEL ─────────────────────────────────────────────────────────── */

.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-soft);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.notif-panel.open {
  transform: translateX(0);
}

/* Panel header */
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.notif-panel-title {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--font-semi);
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-read-all-btn {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

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

.notif-read-all-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.notif-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-close-btn:hover {
  background: var(--bg-hover);
}

.notif-close-btn:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
}

.notif-close-icon {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(0.5);
  pointer-events: none;
  transition: filter 0.15s;
}

.notif-close-btn:hover .notif-close-icon {
  filter: brightness(0) invert(0.85);
}


/* ─── FILTER TABS ────────────────────────────────────────────────────────────── */

.notif-tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.notif-tabs::-webkit-scrollbar {
  display: none;
}

.notif-tab {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 14px;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.notif-tab:hover:not(.active) {
  color: var(--text-secondary);
}

.notif-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}


/* ─── NOTIFICATION LIST ──────────────────────────────────────────────────────── */

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-soft) transparent;
}

.notif-list::-webkit-scrollbar {
  width: 3px;
}

.notif-list::-webkit-scrollbar-track {
  background: transparent;
}

.notif-list::-webkit-scrollbar-thumb {
  background: var(--border-soft);
  border-radius: 2px;
}


/* ─── EMPTY STATE ────────────────────────────────────────────────────────────── */

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 24px;
  text-align: center;
}

.notif-empty-icon {
  width: 44px;
  height: 44px;
  display: block;
  opacity: 0.18;
  filter: brightness(0) invert(1);
}

.notif-empty-title {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.notif-empty-sub {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.55;
}


/* ─── NOTIFICATION ITEM ──────────────────────────────────────────────────────── */

.notif-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px 14px 28px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s ease;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--bg-hover);
}

/* Unread indicator dot */
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-primary);
  flex-shrink: 0;
}

/* Removing animation (JS adds this class before deleting) */
.notif-item.removing {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}


/* Type icon bubble */
.notif-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-type-icon img {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

/* Type-specific tints */
.notif-type-icon.type-transaction {
  background: rgba(22, 163, 74, 0.07);
  border-color: rgba(22, 163, 74, 0.14);
}

.notif-type-icon.type-cashback {
  background: rgba(22, 163, 74, 0.07);
  border-color: rgba(22, 163, 74, 0.14);
}

.notif-type-icon.type-referral {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.14);
}

.notif-type-icon.type-streak {
  background: rgba(217, 119, 6, 0.07);
  border-color: rgba(217, 119, 6, 0.14);
}

.notif-type-icon.type-promo {
  background: rgba(217, 119, 6, 0.07);
  border-color: rgba(217, 119, 6, 0.14);
}

.notif-type-icon.type-security {
  background: rgba(220, 38, 38, 0.07);
  border-color: rgba(220, 38, 38, 0.14);
}

/* Icon tint per type */
.notif-type-icon.type-transaction img,
.notif-type-icon.type-cashback    img { filter: brightness(0) saturate(1) invert(0.4) sepia(1) saturate(3) hue-rotate(90deg); }

.notif-type-icon.type-referral    img { filter: brightness(0) saturate(1) invert(0.4) sepia(1) saturate(5) hue-rotate(200deg); }

.notif-type-icon.type-streak      img,
.notif-type-icon.type-promo       img { filter: brightness(0) saturate(1) invert(0.4) sepia(1) saturate(5) hue-rotate(5deg); }

.notif-type-icon.type-security    img { filter: brightness(0) saturate(1) invert(0.4) sepia(1) saturate(5) hue-rotate(310deg); }


/* Item content */
.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-body {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Chevron arrow (shown when item has an actionUrl) */
.notif-chevron {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
  margin-top: 5px;
  filter: brightness(0) invert(0.25);
  pointer-events: none;
  transition: filter 0.15s;
}

.notif-item:hover .notif-chevron {
  filter: brightness(0) invert(0.45);
}

/* Delete button */
.notif-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.notif-item:hover .notif-delete-btn {
  opacity: 1;
}

.notif-delete-btn:hover {
  background: rgba(220, 38, 38, 0.09);
}

.notif-delete-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}

.notif-delete-icon {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) invert(0.38);
  pointer-events: none;
  transition: filter 0.15s;
}

.notif-delete-btn:hover .notif-delete-icon {
  filter: brightness(0) invert(0.5) sepia(1) saturate(6) hue-rotate(310deg);
}


/* ─── SKELETON LOADERS ───────────────────────────────────────────────────────── */

.notif-skeleton {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-skeleton-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  flex-shrink: 0;
  animation: notif-shimmer 1.6s ease-in-out infinite;
}

.notif-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 3px;
}

.notif-skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: var(--bg-elevated);
  animation: notif-shimmer 1.6s ease-in-out infinite;
}

.notif-skeleton-line.w-full  { width: 100%; }
.notif-skeleton-line.w-three-quarters { width: 75%; }
.notif-skeleton-line.w-two-fifths     { width: 40%; }

@keyframes notif-shimmer {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}


/* ─── RECEIPT BUTTONS ────────────────────────────────────────────────────────── */

.receipt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.receipt-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.receipt-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.receipt-btn:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
}

.receipt-btn-icon {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(0.85);
  pointer-events: none;
  flex-shrink: 0;
  transition: filter 0.15s;
}

/* Email variant — secondary styling */
.receipt-btn.secondary {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.receipt-btn.secondary .receipt-btn-icon {
  filter: brightness(0) invert(0.55);
}

.receipt-btn.secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-soft);
}

.receipt-btn.secondary:hover .receipt-btn-icon {
  filter: brightness(0) invert(0.85);
}

/* Loading state */
.receipt-btn.loading {
  pointer-events: none;
  opacity: 0.65;
}

.receipt-btn.loading .receipt-btn-icon {
  animation: receipt-spin 0.9s linear infinite;
}

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


/* ─── PUSH PERMISSION BANNER ─────────────────────────────────────────────────── */

.push-permission-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.push-permission-banner.hidden {
  display: none;
}

.push-permission-bell {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
  filter: brightness(0) invert(0.7);
  pointer-events: none;
}

.push-permission-copy {
  flex: 1;
  min-width: 0;
}

.push-permission-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.push-permission-sub {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.push-permission-allow-btn {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--font-semi);
  color: var(--bg-base);
  background: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.push-permission-allow-btn:hover {
  opacity: 0.82;
}

.push-permission-dismiss-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.push-permission-dismiss-btn:hover {
  background: var(--bg-hover);
}

.push-permission-dismiss-icon {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) invert(0.35);
  pointer-events: none;
  transition: filter 0.15s;
}

.push-permission-dismiss-btn:hover .push-permission-dismiss-icon {
  filter: brightness(0) invert(0.6);
}


/* ─── BODY SCROLL LOCK (when panel open) ────────────────────────────────────── */

body.notif-panel-open {
  overflow: hidden;
}


/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .notif-panel {
    max-width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-soft);
  }

  .receipt-btn {
    font-size: var(--text-xs);
    padding: 9px 13px;
  }
}


/* ─── REDUCED MOTION ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .notif-panel,
  .notif-overlay,
  .notif-item,
  .notif-item.removing,
  .notif-skeleton-icon,
  .notif-skeleton-line {
    transition: none;
    animation: none;
  }
}
