/*
 * Notifications: the bell in the header (partials/navbar.ejs, js/notifications.js) and the
 * Notifications screens (views/notifications/*.ejs). Every class is .hk-nt-*. Colours come from the
 * theme's own variables (style.css redefines them under [data-theme="dark"]), so both themes work.
 */

/* ------------------------------------------------------------------ the bell */

.hk-nt-bell {
  border: 0;
  color: var(--text-primary-light, #1f2937);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hk-nt-bell:hover,
.hk-nt-bell[aria-expanded="true"] {
  background-color: var(--primary-50, #eef2fb) !important;
  color: var(--primary-600, #2044ac);
}

.hk-nt-bell:focus-visible {
  outline: 2px solid var(--primary-600, #2044ac);
  outline-offset: 2px;
}

.hk-nt.has-unread .hk-nt-bell iconify-icon {
  animation: hk-nt-ring 0.9s ease 1;
}

@keyframes hk-nt-ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hk-nt.has-unread .hk-nt-bell iconify-icon { animation: none; }
}

.hk-nt-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger-600, #dc2626);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--white, #fff);
  font-variant-numeric: tabular-nums;
}

.hk-nt-badge[hidden] { display: none; }

/* ------------------------------------------------------------------ the dropdown */

.hk-nt-menu {
  width: 400px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  margin-top: 10px !important;
  background: var(--white, #fff);
}

.hk-nt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.hk-nt-head__title { display: flex; flex-direction: column; min-width: 0; }

.hk-nt-head__name {
  font-family: var(--hk-display, inherit);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary-light, #111827);
}

.hk-nt-head__sub { font-size: 0.8125rem; color: var(--text-secondary-light, #6b7280); }

.hk-nt-textbtn {
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-600, #2044ac);
  white-space: nowrap;
  text-decoration: none;
}

.hk-nt-textbtn:hover,
.hk-nt-textbtn:focus-visible {
  background: var(--primary-50, #eef2fb);
  color: var(--primary-700, #1b3a93);
}

.hk-nt-textbtn[hidden] { display: none; }

.hk-nt-filter {
  display: flex;
  gap: 4px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--hk-line, #e6eaf3);
}

.hk-nt-filter button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary-light, #6b7280);
}

.hk-nt-filter button.is-active {
  background: var(--primary-50, #eef2fb);
  color: var(--primary-600, #2044ac);
}

.hk-nt-list {
  max-height: min(420px, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hk-nt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary-light, #6b7280);
}

.hk-nt-empty iconify-icon { font-size: 28px; opacity: 0.6; }

.hk-nt-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--hk-line, #e6eaf3);
}

.hk-nt-item:last-child { border-bottom: 0; }

.hk-nt-item:hover { background: var(--neutral-50, #f9fafb); }

.hk-nt-item.is-unread { background: var(--primary-50, #eef2fb); }

.hk-nt-item.is-unread::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--primary-600, #2044ac);
}

.hk-nt-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
}

.hk-nt-tone-info { background: var(--info-50, #e0f2fe); color: var(--info-600, #0284c7); }
.hk-nt-tone-success { background: var(--success-50, #dcfce7); color: var(--success-600, #16a34a); }
.hk-nt-tone-warning { background: var(--warning-50, #fef3c7); color: var(--warning-600, #d97706); }
.hk-nt-tone-danger { background: var(--danger-50, #fee2e2); color: var(--danger-600, #dc2626); }

[data-theme="dark"] .hk-nt-tone-info { background: rgba(2, 132, 199, 0.18); }
[data-theme="dark"] .hk-nt-tone-success { background: rgba(22, 163, 74, 0.18); }
[data-theme="dark"] .hk-nt-tone-warning { background: rgba(217, 119, 6, 0.18); }
[data-theme="dark"] .hk-nt-tone-danger { background: rgba(220, 38, 38, 0.18); }
[data-theme="dark"] .hk-nt-item.is-unread { background: rgba(74, 111, 214, 0.12); }
[data-theme="dark"] .hk-nt-item:hover { background: rgba(255, 255, 255, 0.04); }

.hk-nt-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}

.hk-nt-body:focus-visible { outline: 2px solid var(--primary-600, #2044ac); outline-offset: 2px; border-radius: 4px; }

.hk-nt-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary-light, #111827);
  overflow-wrap: anywhere;
}

.hk-nt-item:not(.is-unread) .hk-nt-title { font-weight: 500; }

.hk-nt-repeat {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-200, #e5e7eb);
  font-size: 0.6875rem;
  font-weight: 700;
  vertical-align: 1px;
}

.hk-nt-text {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary-light, #4b5563);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.hk-nt-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-secondary-light, #6b7280);
}

.hk-nt-module { font-weight: 600; }

.hk-nt-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.hk-nt-item:hover .hk-nt-actions,
.hk-nt-item:focus-within .hk-nt-actions { opacity: 1; }

@media (hover: none) {
  .hk-nt-actions { opacity: 1; }
}

.hk-nt-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary-light, #6b7280);
  font-size: 17px;
  text-decoration: none;
}

.hk-nt-iconbtn:hover,
.hk-nt-iconbtn:focus-visible {
  background: var(--neutral-200, #e5e7eb);
  color: var(--primary-600, #2044ac);
}

.hk-nt-iconbtn--danger:hover,
.hk-nt-iconbtn--danger:focus-visible { color: var(--danger-600, #dc2626); }

.hk-nt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 10px;
  border-top: 1px solid var(--hk-line, #e6eaf3);
}

/* A phone: the dropdown spans the screen below the header rather than hanging off the bell. */
@media (max-width: 575.98px) {
  .hk-nt { position: static; }
  .hk-nt-menu {
    position: fixed !important;
    inset: 64px 8px auto 8px !important;
    transform: none !important;
    width: auto;
    max-width: none;
  }
  .hk-nt-list { max-height: calc(100vh - 220px); }
}

/* ------------------------------------------------------------------ the Notifications screen */

.hk-nt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hk-nt-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--hk-line, #e6eaf3);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary-light, #4b5563);
  text-decoration: none;
}

.hk-nt-tabs a.is-active {
  background: var(--primary-600, #2044ac);
  border-color: var(--primary-600, #2044ac);
  color: #fff;
}

.hk-nt-page-list { list-style: none; margin: 0; padding: 0; }

.hk-nt-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hk-line, #e6eaf3);
}

.hk-nt-row:last-child { border-bottom: 0; }

.hk-nt-row.is-unread { background: var(--primary-50, #eef2fb); }

[data-theme="dark"] .hk-nt-row.is-unread { background: rgba(74, 111, 214, 0.12); }

.hk-nt-row__check { padding-top: 9px; }

.hk-nt-row__main { flex: 1; min-width: 0; }

.hk-nt-row__title {
  display: inline;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary-light, #111827);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.hk-nt-row:not(.is-unread) .hk-nt-row__title { font-weight: 500; }

a.hk-nt-row__title:hover { color: var(--primary-600, #2044ac); text-decoration: underline; }

.hk-nt-row__body {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary-light, #4b5563);
  overflow-wrap: anywhere;
}

.hk-nt-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary-light, #6b7280);
}

.hk-nt-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--neutral-100, #f3f4f6);
  font-size: 0.75rem;
  font-weight: 600;
}

.hk-nt-pill--unread { background: var(--primary-600, #2044ac); color: #fff; }

.hk-nt-row__actions { display: flex; gap: 4px; flex: none; }

.hk-nt-row__actions form { margin: 0; }

.hk-nt-bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--hk-line, #e6eaf3);
  background: var(--neutral-50, #f9fafb);
}

[data-theme="dark"] .hk-nt-bulkbar { background: rgba(255, 255, 255, 0.03); }

@media (max-width: 575.98px) {
  .hk-nt-row { padding: 12px 14px; gap: 10px; }
  .hk-nt-row .hk-nt-icon { display: none; }
  .hk-nt-bulkbar { padding: 10px 14px; }
}

/* Settings: the preference matrix. */
.hk-nt-pref-table th,
.hk-nt-pref-table td { vertical-align: middle; }

.hk-nt-pref-table .form-switch { display: inline-flex; justify-content: center; padding-left: 2.5em; margin: 0; }

.hk-nt-pref-module {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-primary-light, #111827);
}

.hk-nt-pref-type__label { font-weight: 600; color: var(--text-primary-light, #111827); }

.hk-nt-pref-type__desc { display: block; font-size: 0.8125rem; color: var(--text-secondary-light, #6b7280); }

.hk-nt-important {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger-50, #fee2e2);
  color: var(--danger-600, #dc2626);
  font-size: 0.6875rem;
  font-weight: 700;
  vertical-align: 1px;
}
