/* ============================================================
   Notification Center — Bhajan Planner
   Mobile-first notification bell, panel, and settings styles
   ============================================================ */

/* ── Global Viewport Protection ─────────────────────────────── */
html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ── Notification Bell Button ─────────────────────────────── */
.notif-bell-btn {
  border-radius: 50%;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--ink, #1e293b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  outline: none;
  position: relative;
}
.notif-bell-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(230, 81, 0, 0.45);
}
.notif-bell-btn:active {
  transform: scale(0.95);
}
.notif-bell-icon {
  width: 24px;
  height: 24px;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #e03131;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
  line-height: 1;
}

.notif-badge:empty {
  display: none !important;
}

.notif-badge.has-unread {
  display: flex !important;
}

/* ── Notification Panel ───────────────────────────────────── */
.notif-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(100%);
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    visibility 0.25s;
}
.notif-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.notif-panel-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #333;
}
.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-mark-all {
  display: none !important;
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}
.notif-mark-all:hover {
  background: #f5f5f5;
  color: #333;
}
.notif-settings-link {
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}
.notif-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 4px;
}
.notif-close-btn:hover {
  color: #333;
}

/* ── Panel Body ───────────────────────────────────────────── */
.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}
.notif-loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}
.notif-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}
.notif-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.notif-empty-text {
  font-size: 14px;
  line-height: 1.5;
}

/* ── Notification Item ────────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  padding: 14px 20px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
  gap: 12px;
}
.notif-item:hover {
  background: #faf8f5;
}
.notif-item.unread {
  background: #fff8f0;
  border-left: 3px solid #ff9933;
}
.notif-item.unread:hover {
  background: #fff3e0;
}
.notif-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.notif-item-content {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 0 0 3px;
  line-height: 1.35;
}
.notif-item-body {
  font-size: 14.5px;
  color: #666;
  margin: 0 0 5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-time {
  font-size: 13px;
  color: #888;
}
.notif-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff9933;
  flex-shrink: 0;
  margin-top: 6px;
}

/* ── Overlay ──────────────────────────────────────────────── */
.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.notif-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Notification Settings Page ────────────────────────────── */
.notif-settings-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
}
.notif-settings-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
}
.notif-settings-card h2 {
  font-size: 20px;
  color: #333;
  margin: 0 0 8px;
  text-align: center;
}
.notif-settings-card .subtitle {
  font-size: 13px;
  color: #888;
  text-align: center;
  margin-bottom: 24px;
}
.notif-settings-card label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #444;
  margin-bottom: 8px;
}
.notif-singer-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  background: #fafafa;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}
.notif-singer-select:focus {
  outline: none;
  border-color: #ff9933;
  background: #fff;
}
.notif-btn-enable {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff9933 0%, #e65100 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.notif-btn-enable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}
.notif-btn-enable:active {
  transform: translateY(0);
}
.notif-btn-enable:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.notif-btn-disable {
  width: 100%;
  padding: 12px;
  border: 1px solid #e03131;
  border-radius: 10px;
  background: transparent;
  color: #e03131;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s;
}
.notif-btn-disable:hover {
  background: #fff5f5;
}
.notif-status-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.notif-status-card.disabled {
  background: #fef2f2;
  border-color: #fecaca;
}
.notif-status-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}
.notif-status-value {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 768px) {
  .notif-panel {
    bottom: 80px;
    right: 24px;
    border-radius: 16px;
    max-height: 520px;
    width: 390px;
    transform: translateY(16px) scale(0.97);
    transition:
      transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.25s ease,
      visibility 0.25s;
  }
  .notif-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .notif-bell-btn {
    bottom: 24px;
    right: 24px;
  }
}

@media (max-width: 360px) {
  .notif-bell-btn {
    width: 46px;
    height: 46px;
    bottom: 16px;
    right: 16px;
  }
  .notif-bell-icon {
    width: 20px;
    height: 20px;
  }
  .notif-panel-header {
    padding: 12px 16px 10px;
  }
  .notif-item {
    padding: 12px 16px;
  }
}

/* ── First-Visit Notification Permission Prompt ───────────── */
.notif-prompt-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.notif-prompt-overlay.show {
  opacity: 1;
}

.notif-prompt-modal {
  width: 100%;
  max-width: 450px;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 24px;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}
.notif-prompt-overlay.show .notif-prompt-modal {
  transform: translateY(0);
}

.notif-prompt-modal,
.notif-prompt-modal *,
.notif-prompt-modal *::before,
.notif-prompt-modal *::after {
  box-sizing: border-box;
  max-width: 100%;
}

.notif-prompt-modal p,
.notif-prompt-modal span,
.notif-prompt-modal li,
.notif-prompt-modal div,
.notif-prompt-modal label {
  word-break: break-word;
  overflow-wrap: break-word;
}

.notif-prompt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.notif-prompt-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff3e0;
  color: #e65100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.notif-prompt-titles {
  flex: 1;
}
.notif-prompt-title {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
  color: #222;
}
.notif-prompt-subtitle {
  margin: 0;
  font-size: 13px;
  color: #888;
}
.notif-prompt-desc {
  font-size: 14.5px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 16px;
}
.notif-prompt-form {
  margin-bottom: 18px;
}
.notif-prompt-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}
.notif-prompt-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14.5px;
  background: #fafafa;
  color: #333;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.notif-prompt-select:focus {
  outline: none;
  border-color: #ff9933;
  background: #fff;
}
.notif-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-btn-prompt-enable {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff9933 0%, #e65100 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    opacity 0.2s,
    transform 0.15s;
}
.notif-btn-prompt-enable:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.notif-btn-prompt-dismiss {
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 13.5px;
  cursor: pointer;
  touch-action: manipulation;
}
.notif-btn-prompt-dismiss:hover {
  color: #444;
}
.notif-prompt-footer {
  margin-top: 10px;
  font-size: 12.5px;
  color: #888;
  text-align: center;
  line-height: 1.45;
}

@media (min-width: 600px) {
  .notif-prompt-overlay {
    align-items: center;
    padding: 20px;
  }
  .notif-prompt-modal {
    border-radius: 20px;
    transform: scale(0.95);
  }
  .notif-prompt-overlay.show .notif-prompt-modal {
    transform: scale(1);
  }
}

/* ── Benefits Callout ("Why Enable Notifications?") ────────── */
.notif-benefits-box {
  background: linear-gradient(135deg, #fff9db 0%, #fff3bf 100%);
  border: 1px solid #ffe066;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.notif-benefits-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #d9480f;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.notif-benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.notif-benefits-list li {
  font-size: 13px;
  color: #495057;
  line-height: 1.45;
}
.notif-benefits-list li strong {
  color: #212529;
}

/* ── 4-Digit Security PIN Section ───────────────────────────── */
.notif-pin-section {
  margin-top: 14px;
  animation: notifFadeIn 0.25s ease-out;
}
@keyframes notifFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notif-pin-security-notice {
  background: #e7f5ff;
  border: 1px solid #a5d8ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #1864ab;
}
.notif-pin-security-notice.existing {
  background: #f8f9fa;
  border-color: #dee2e6;
  color: #495057;
}
.notif-pin-notice-header {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.notif-pin-notice-desc {
  margin: 0 0 6px;
  color: #1971c2;
}
.notif-pin-security-notice.existing .notif-pin-notice-desc {
  color: #495057;
}
.notif-pin-notice-reminder {
  margin: 0;
  font-size: 12.5px;
  color: #3b5bdb;
  border-top: 1px dashed #bac8ff;
  padding-top: 5px;
}

.notif-pin-input-group {
  margin-bottom: 14px;
}
.notif-pin-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.notif-pin-field-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.notif-pin-input {
  flex: 1 1 auto;
  min-width: 0 !important;
  width: 0;
  box-sizing: border-box !important;
  padding: 10px 12px;
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  border: 2px solid #ffd8a8;
  border-radius: 10px;
  background: #fff;
  color: #333;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.notif-pin-input:focus {
  outline: none;
  border-color: #ff9933;
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.25);
}
.notif-pin-input.is-invalid {
  border-color: #fa5252;
  box-shadow: 0 0 0 3px rgba(250, 82, 82, 0.2);
}
.notif-pin-toggle-btn {
  background: #f1f3f5;
  border: 1px solid #ced4da;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}
.notif-pin-help {
  font-size: 12px;
  color: #868e96;
  margin-top: 4px;
}
.notif-pin-error {
  font-size: 12px;
  color: #e03131;
  font-weight: 600;
  margin-top: 6px;
  display: none;
}

/* ============================================================
   DARK MODE — NOTIFICATION CENTER & SETTINGS
   ============================================================ */

[data-theme="dark"] .notif-panel {
  background: #151824;
  border-left: 1px solid #262d40;
  border-top: 1px solid #262d40;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .notif-panel-header {
  border-bottom-color: #262d40;
}

[data-theme="dark"] .notif-panel-header h3 {
  color: #f8fafc;
}

[data-theme="dark"] .notif-mark-all {
  border-color: #262d40;
  color: #cbd5e1;
}

[data-theme="dark"] .notif-mark-all:hover {
  background: #1e2538;
  color: #f8fafc;
}

[data-theme="dark"] .notif-close-btn {
  color: #94a3b8;
}

[data-theme="dark"] .notif-close-btn:hover {
  color: #f8fafc;
}

[data-theme="dark"] .notif-item {
  background: #151824;
  border-bottom-color: #1f2537;
}

[data-theme="dark"] .notif-item:hover {
  background: #1a1f2e;
}

[data-theme="dark"] .notif-item.unread {
  background: #1a2236;
}

[data-theme="dark"] .notif-item-title {
  color: #f8fafc;
}

[data-theme="dark"] .notif-item-body {
  color: #cbd5e1;
}

[data-theme="dark"] .notif-item-time {
  color: #94a3b8;
}

[data-theme="dark"] .notif-empty {
  color: #94a3b8;
}

/* Settings Page */
[data-theme="dark"] .notif-settings-card {
  background: #151824;
  border: 1px solid #262d40;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .notif-settings-card h2 {
  color: #f8fafc;
}

[data-theme="dark"] .notif-settings-card .subtitle {
  color: #94a3b8;
}

[data-theme="dark"] .notif-benefits-box {
  background: #1a1f2e;
  border-color: #262d40;
}

[data-theme="dark"] .notif-benefits-title {
  color: #f59e0b;
}

[data-theme="dark"] .notif-benefits-list li {
  color: #cbd5e1;
}

[data-theme="dark"] .notif-status-card {
  background: #1a1f2e;
  border-color: #262d40;
}

[data-theme="dark"] .notif-status-label {
  color: #94a3b8;
}

[data-theme="dark"] .notif-status-value {
  color: #f8fafc;
}

[data-theme="dark"] .notif-singer-select {
  background: #1a1f2e;
  border-color: #2e374c;
  color: #f8fafc;
}

[data-theme="dark"] .notif-pin-section {
  background: #1a1f2e;
  border-color: #262d40;
}

[data-theme="dark"] .notif-pin-security-notice {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #cbd5e1;
}

[data-theme="dark"] .notif-pin-input {
  background: #131722;
  border-color: #2e374c;
  color: #f8fafc;
}

[data-theme="dark"] .notif-pin-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .notif-pin-toggle-btn {
  background: #202638;
  border-color: #2e374c;
  color: #cbd5e1;
}

[data-theme="dark"] .notif-pin-help {
  color: #94a3b8;
}

[data-theme="dark"] .notif-prompt-banner {
  background: #151824;
  border-color: #262d40;
  color: #f8fafc;
}

/* ── Print Media: Completely Suppress Notification UI ── */
@media print {
  .notif-bell-btn,
  #notifBellBtn,
  .notif-badge,
  #notifBadge,
  .notif-panel,
  #notifPanel,
  .notif-overlay,
  #notifOverlay,
  .notif-prompt-overlay,
  #notifPromptOverlay,
  .notification-bell-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
  }
}
