/* ========== NOTIFICATIONS PAGE ========== */

#page-notifications {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#page-notifications.active {
  display: flex;
}

#notifications-content {
  padding-left: 16px;
  padding-right: 16px;
}

/* ── Header ── */
.notif-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ── Stats bar ── */
.notif-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 16px 10px;
  background: var(--bg-primary);
  flex-shrink: 0;
  position: sticky;
  top: 61px;
  z-index: 10;
}
.notif-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 90px;
}
.notif-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.notif-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.notif-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.08);
}

/* ── Day-of-week activity graph ── */
.notif-weekday-chart {
  padding: 6px 16px 14px;
  background: var(--bg-primary);
}
.notif-wd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.notif-wd-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border: 1px solid var(--accent-primary);
  border-radius: 12px;
  background: rgba(99,102,241,0.12);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.notif-wd-clear:hover { background: rgba(99,102,241,0.22); }
.notif-wd-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 122px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.notif-wd-bars::-webkit-scrollbar { height: 5px; }
.notif-wd-bars::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
.notif-wd-bars::-webkit-scrollbar-track { background: transparent; }
.notif-wd-col {
  /* grow to fill when there are few days, but never shrink below 38px so the
     row scrolls horizontally once there are many days */
  flex: 1 0 38px;
  min-width: 38px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
}
.notif-wd-col:hover .notif-wd-track { background: rgba(255,255,255,0.09); }
.notif-wd-col:hover .notif-wd-bar   { filter: brightness(1.15); }
.notif-wd-col--selected .notif-wd-track {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}
.notif-wd-col--selected .notif-wd-label,
.notif-wd-col--selected .notif-wd-date {
  color: var(--text-primary);
  font-weight: 700;
}
.notif-wd-empty {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}
.notif-wd-val {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  height: 12px;
  line-height: 12px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.notif-wd-track {
  width: 72%;
  max-width: 26px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  overflow: hidden;
}
.notif-wd-bar {
  width: 100%;
  background: var(--accent-primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.notif-wd-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.notif-wd-date {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.8;
}
.notif-wd-col.today .notif-wd-bar {
  background: var(--success, #4ade80);
}
.notif-wd-col.today .notif-wd-label {
  color: var(--text-primary);
  font-weight: 700;
}
.notif-wd-col.today .notif-wd-date {
  color: var(--text-secondary);
  font-weight: 600;
  opacity: 1;
}

/* ── Filters ── */
.notif-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px 10px;
  background: var(--bg-primary);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: sticky;
  top: 112px;
  z-index: 10;
}
.notif-filter-pills {
  display: flex;
  gap: 6px;
}
.notif-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.notif-pill:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--text-secondary);
}
.notif-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.notif-date-select {
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.notif-date-select:focus {
  border-color: var(--accent-primary);
}

.notif-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.btn-clear-notif {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 20px;
  color: rgba(239,68,68,0.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-clear-notif:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  border-color: rgba(239,68,68,0.5);
  transform: scale(1.02);
}
.btn-clear-notif:active { transform: scale(0.97); }

/* ── Scrollable list ── */
#notifications-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 120px;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── Day label ── */
.notif-day-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 18px 4px 8px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 2;
}

/* ── Group ── */
.notif-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
  border-radius: 18px;
  overflow: hidden;
}

/* first and last card rounded corners to mimic iPhone grouping */
.notif-group .notif-card:first-child { border-radius: 18px 18px 6px 6px; }
.notif-group .notif-card:last-child  { border-radius: 6px 6px 18px 18px; }
.notif-group .notif-card:only-child  { border-radius: 18px; }

/* ========== NOTIFICATION CARD ========== */

.notif-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  transition: background 0.12s, transform 0.28s ease, opacity 0.2s ease;
  cursor: default;
  user-select: none;
}
.notif-card:active { background: var(--bg-elevated); }
.notif-card.notif-cashout { background: rgba(34,197,94,0.04); }
.notif-card.notif-burst   { background: rgba(239,68,68,0.04); }

/* Shimmer on enter */
@keyframes notifSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-card { animation: notifSlideIn 0.22s ease both; }

/* ── Icon ── */
.notif-icon-wrap {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-icon-cashout {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.18);
}
.notif-icon-burst {
  background: rgba(239,68,68,0.11);
  color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.16);
}
.notif-icon-info {
  background: rgba(99,102,241,0.11);
  color: #818cf8;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.16);
}

/* ── Body ── */
.notif-body-wrap { flex: 1; min-width: 0; }

.notif-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.notif-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-desc {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ── Dismiss button ── */
.notif-dismiss {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}
.notif-card:hover .notif-dismiss { opacity: 1; }
.notif-dismiss:hover {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}
.notif-dismiss:active { transform: scale(0.88); }

/* Touch devices — dismiss always fully visible */
@media (hover: none) {
  .notif-dismiss { opacity: 0.55; }
}

/* ── Unread accent bar ── */
.notif-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.notif-card:not([data-read="true"])::before { opacity: 1; }
.notif-cashout::before { background: #22c55e; }
.notif-burst::before   { background: #ef4444; }
.notif-info::before    { background: #818cf8; }

/* ── Unread dot on title ── */
.notif-card:not([data-read="true"]) .notif-title::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.notif-card.notif-cashout:not([data-read="true"]) .notif-title::after { background: #22c55e; }
.notif-card.notif-burst:not([data-read="true"])   .notif-title::after { background: #ef4444; }

/* ========== EMPTY STATE ========== */

#notif-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 60px;
  gap: 14px;
  text-align: center;
}

.notif-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.notif-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.notif-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 210px;
  line-height: 1.6;
}

/* ========== HEADER BADGE ========== */

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

/* ── Source/mode chip (Manual / Auto-freebet / App) ── */
.notif-source {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-radius: 8px;
  vertical-align: middle;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}
.notif-source-manual { background: rgba(148,163,184,0.16); color: #cbd5e1; }
.notif-source-auto   { background: rgba(99,102,241,0.16);  color: #a5b4fc; }
.notif-source-app    { background: rgba(34,197,94,0.14);   color: #4ade80; }

#notifications-btn { position: relative; }
