/* ═══ STUDIOHAUS PORTAL — Notifications (js/notifications.js) ═══
   Bell at the top of the sidebar, the Notifications item (a bell tab in the
   phone tab bar) and the list: frosted glass over the page. Monochrome,
   portal tokens, both themes. Below modals (z 500), so Notification settings
   opens on top of the list. */

/* ─── Bell (computers and tablets: the sidebar's top row) ─── */
.nt-bell {
  position: relative;
  flex: none;
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-60);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.nt-bell svg { width: 16px; height: 16px; transform-origin: 50% 12%; }
.nt-bell:hover,
.nt-bell.is-open { color: var(--text); background: var(--bg-card-hover); border-color: var(--border-hover); }
.nt-bell.has-unread { color: var(--text); }
.nt-bell:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.nt-count {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  font-weight: var(--fw-semi);
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #111111;
}
.nt-count[hidden] { display: none; }
[data-theme="light"] .nt-count { box-shadow: 0 0 0 2px #f5f5f4; }
.nt-bell.is-new svg { animation: ntRing 0.9s ease; }
@keyframes ntRing {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); }
  75% { transform: rotate(2deg); }
}

/* Tablets: the 200px sidebar fits the name and the bell, not the ADMIN / PORTAL tag too */
@media (min-width: 769px) and (max-width: 1024px) {
  .admin-sidebar-brand:has(.nt-bell) .admin-sidebar-brand-text span { display: none; }
}

/* Sidebar item: the count is .wf-badge (workflow.css), solid like the bell's */
.admin-sidebar-item .wf-badge.nt-badge { background: var(--text); color: var(--bg); }
.admin-sidebar-item[data-nt-open].is-open { color: var(--text); background: var(--bg-card); }
.admin-sidebar-item[data-nt-open].is-open .admin-sidebar-icon { opacity: 1; }

/* Read by screen readers only (Unread, the status line) */
.nt-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─── Panel ─── */
.nt-root[hidden] { display: none; }
.nt-backdrop { display: none; }

.nt-panel {
  position: fixed;
  z-index: 460;
  top: 12px;
  left: 252px;
  width: 420px;
  max-width: calc(100vw - 264px);
  max-height: min(720px, calc(100vh - 24px));
  max-height: min(720px, calc(100dvh - 24px));
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--font);
  /* Opaque enough that small text stays readable over bright photos */
  background: rgba(20, 20, 20, 0.9);
  -webkit-backdrop-filter: blur(32px) saturate(1.2);
  backdrop-filter: blur(32px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  outline: none;
  animation: ntIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="light"] .nt-panel {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
@keyframes ntIn { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
@media (min-width: 769px) and (max-width: 1024px) {
  .nt-panel { left: 212px; max-width: calc(100vw - 224px); }
}
html.native-glass .nt-panel { top: 40px; max-height: min(720px, calc(100vh - 52px)); }

.nt-grabber { display: none; }

.nt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 12px 10px 10px 18px;
}
/* All caps tracked heading, as the portal's section titles */
.nt-title {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-60);
}
.nt-head-actions { display: flex; align-items: center; gap: 2px; }
.nt-text-btn,
.nt-icon-btn {
  background: none;
  border: 0;
  color: var(--text-60);
  font-family: var(--font);
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.nt-text-btn { padding: 6px 8px; white-space: nowrap; }
.nt-text-btn[hidden] { display: none; }
.nt-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; }
.nt-icon-btn svg { width: 16px; height: 16px; }
.nt-text-btn:hover,
.nt-icon-btn:hover { color: var(--text); background: var(--bg-card-hover); }
.nt-text-btn:disabled { opacity: 0.4; cursor: default; background: none; color: var(--text-60); }

/* Filter by kind: toggle buttons with the Team tabs' look (team.css) */
.nt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 14px 12px;
  flex: none;
}
.nt-filters[hidden] { display: none; }
.nt-filter {
  flex: none;
  background: none;
  border: 1px solid transparent;
  color: var(--text-60);
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 100px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.nt-filter-n {
  font-size: 10px;
  color: var(--text-60);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 6px;
  line-height: 15px;
  font-variant-numeric: tabular-nums;
}
.nt-filter:hover { color: var(--text); }
.nt-filter.is-on { color: var(--text); background: var(--bg-card-hover); border-color: var(--border-hover); }
.nt-filter.is-on .nt-filter-n { color: var(--text); }

/* This device gets no pushes (phones only) */
.nt-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 10px;
  padding: 8px 6px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: var(--fs-sm);
  color: var(--text-60);
  flex: none;
}
.nt-hint[hidden] { display: none; }
.nt-hint-text { flex: 1; min-width: 0; line-height: 1.4; }
.nt-hint-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.nt-hint-x { width: 28px; height: 28px; }
.nt-hint-x svg { width: 14px; height: 14px; }

/* ─── List ─── */
.nt-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 6px 8px;
  border-top: 1px solid var(--border);
}
.nt-group-title {
  margin: 0;
  padding: 14px 12px 6px;
  font-size: 10px;
  font-weight: var(--fw-semi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-60);
}
.nt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.nt-item:hover { background: var(--bg-card-hover); }
.nt-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.nt-ico {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-45);
}
.nt-ico svg { width: 15px; height: 15px; }
.nt-item.is-unread .nt-ico { color: var(--text); border-color: var(--border-hover); background: var(--bg-card-hover); }
.nt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-item-title { font-size: var(--fs-base); line-height: 1.35; color: var(--text-60); overflow-wrap: anywhere; }
.nt-item.is-unread .nt-item-title { color: var(--text); font-weight: var(--fw-medium); }
.nt-item-body {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-60);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.nt-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--text-60);
  font-variant-numeric: tabular-nums;
}
.nt-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--text);
}

/* Empty and error states are .empty-state (components.css) */
.nt-list .empty-state { min-height: 220px; justify-content: center; }

.nt-loading { padding: 10px 6px; }
.nt-skel { display: flex; gap: 12px; padding: 10px 6px; }
.nt-skel-ico { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.nt-skel-lines { flex: 1; padding-top: 2px; }

.nt-more { padding: 6px 6px 2px; }
.nt-more-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-60);
  font-family: var(--font);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.nt-more-btn:hover { color: var(--text); background: var(--bg-card-hover); }
.nt-more-btn[aria-disabled="true"] { cursor: default; color: var(--text-60); background: none; }
.nt-end { padding: 14px 12px 8px; text-align: center; font-size: var(--fs-xs); color: var(--text-60); }

/* ─── Phones: a bell tab in the bottom bar, the list as a sheet above it ─── */
@media (max-width: 768px) {
  /* The tab is the bell and its count; its name (Notifications, and the
     unread count) stays for screen readers and Voice Control. The empty
     line keeps the bell level with the other tabs' icons. */
  .admin-sidebar > .admin-sidebar-item.nt-tab { min-width: 44px; }
  .admin-sidebar > .admin-sidebar-item.nt-tab .nt-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .admin-sidebar > .admin-sidebar-item.nt-tab::after { content: ''; display: block; height: 1.2em; height: 1lh; }

  /* While the sheet is open it is the one active tab */
  .admin-sidebar > .admin-sidebar-item[data-nt-open].is-open { background: transparent; color: var(--brand-accent); }
  .admin-sidebar > .admin-sidebar-item[data-nt-open].is-open .admin-sidebar-icon { opacity: 1; }
  .admin-sidebar > .admin-sidebar-item[data-nt-open].is-open::before {
    content: '';
    position: absolute;
    display: block;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--brand-accent);
  }
  html.nt-open .admin-sidebar > .admin-sidebar-item.active:not([data-nt-open]),
  html.nt-open .sidebar-more:has(.sidebar-more-item.active) > .sidebar-more-toggle { color: var(--text-60); }
  html.nt-open[data-theme="light"] .admin-sidebar > .admin-sidebar-item.active:not([data-nt-open]),
  html.nt-open[data-theme="light"] .sidebar-more:has(.sidebar-more-item.active) > .sidebar-more-toggle { color: rgba(0, 0, 0, 0.6); }
  html.nt-open .admin-sidebar > .admin-sidebar-item.active:not([data-nt-open])::before,
  html.nt-open .sidebar-more:has(.sidebar-more-item.active) > .sidebar-more-toggle::before { display: none; }
  html.nt-open .admin-sidebar > .admin-sidebar-item.active:not([data-nt-open]) .admin-sidebar-icon,
  html.nt-open .sidebar-more:has(.sidebar-more-item.active) > .sidebar-more-toggle .admin-sidebar-icon { opacity: 0.55; }

  .nt-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(61px + env(safe-area-inset-bottom));
    z-index: 459;
    background: rgba(0, 0, 0, 0.5);
    animation: ntFade 0.2s ease;
  }
  .nt-panel {
    top: calc(env(safe-area-inset-top, 0px) + 40px);
    left: 0;
    right: 0;
    bottom: calc(61px + env(safe-area-inset-bottom));
    width: 100%;
    max-width: none;
    max-height: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation: ntUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.2s ease;
  }
  /* Pull down by the grabber or the header to close */
  .nt-panel.is-dragging { transition: none; animation: none; }
  .nt-grabber { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--text-20); margin: 8px auto 0; flex: none; }
  .nt-grabber,
  .nt-head { touch-action: none; }
  .nt-head { padding: 8px 8px 10px 18px; }
  .nt-text-btn { min-height: 40px; padding: 0 10px; }
  .nt-icon-btn { width: 40px; height: 40px; }
  .nt-filters { gap: 6px; }
  .nt-filter { min-height: 34px; padding: 6px 12px; font-size: 13px; }
  .nt-item { padding: 12px; }
  .nt-item-title { font-size: var(--fs-md); }
  .nt-hint-x { width: 36px; height: 36px; }
}
@keyframes ntUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ntFade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .nt-panel, .nt-backdrop, .nt-bell.is-new svg { animation: none; }
  .nt-panel { transition: none; }
}
