/* ===================================================================
   Notification center — bell badge + dropdown panel.
   RTL-first (logical properties), dark-mode safe via design tokens.
   Tokens already adapt to html[data-theme]; never hardcode brand colors.
   =================================================================== */

/* ── bell wrapper must anchor the absolute panel + badge ── */
.tn-notif {
  position: relative;
}

/* ── unread badge: pill at the top-inline-start corner of the bell ── */
.tn-bell {
  position: relative;
}

.tn-bell-badge {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  border: 2px solid var(--surface, var(--bg-primary));
}

.tn-bell-badge[hidden] {
  display: none;
}

/* ── dropdown panel ── */
.tn-notif-panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 340px;
  max-width: 92vw;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.tn-notif-panel.is-open {
  animation: tn-notif-pop 0.14s ease-out;
}

@keyframes tn-notif-pop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── header ── */
.tn-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-block-end: 1px solid var(--border);
  flex: 0 0 auto;
}

.tn-notif-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.tn-notif-readall {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-600);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tn-notif-readall:hover {
  background: var(--surface-hover);
  color: var(--brand-700);
}

.tn-notif-readall:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 1px;
}

/* ── scrollable list ── */
.tn-notif-list {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

/* ── a row (anchor or button — reset both) ── */
.tn-notif-row {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: start;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-block-end: 1px solid var(--border);
  transition: background 0.12s;
  color: inherit;
}

.tn-notif-row:last-child {
  border-block-end: 0;
}

.tn-notif-row:hover {
  background: var(--surface-hover);
}

.tn-notif-row:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: -2px;
}

.tn-notif-row.is-unread {
  background: color-mix(in srgb, var(--brand-500) 6%, transparent);
}

.tn-notif-row.is-unread:hover {
  background: var(--surface-hover);
}

/* ── row icon ── */
.tn-notif-row-ic {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.tn-notif-row-ic svg {
  width: 18px;
  height: 18px;
}

/* tinted icons by type */
.tn-notif-ic-balance {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}

.tn-notif-ic-update,
.tn-notif-row-ic.tn-notif-ic-update {
  background: color-mix(in srgb, var(--brand-500) 16%, transparent);
  color: var(--brand-600);
}

.tn-notif-ic-reply {
  background: color-mix(in srgb, #06b6d4 16%, transparent);
  color: #06b6d4;
}

/* ── row text ── */
.tn-notif-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tn-notif-row-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.tn-notif-row-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tn-notif-row-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-block-start: 2px;
}

/* ── unread dot ── */
.tn-notif-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-600);
  margin-block-start: 6px;
  margin-inline-start: 2px;
}

/* ── empty state ── */
.tn-notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
}

.tn-notif-empty-ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--text-tertiary);
}

.tn-notif-empty-ic svg {
  width: 22px;
  height: 22px;
}

.tn-notif-empty-txt {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ── mobile: near full-width, fixed so it can't overflow the viewport ── */
@media (max-width: 480px) {
  .tn-notif-panel {
    position: fixed;
    inset-block-start: 64px;
    inset-inline-start: 8px;
    inset-inline-end: 8px;
    min-width: 0;
    width: auto;
    max-width: none;
    max-height: 75vh;
  }
}
