/* ── Notification Hub (fixed overlay, top-right) ── */
#notifications-hub {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9000;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

#notifications-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Individual Popup ── */
.notification {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .10), 0 1px 4px rgba(0, 0, 0, .06);
  padding: 12px 14px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(calc(100% + 24px));
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.notification.notification--visible {
  opacity: 1;
  transform: translateX(0);
}

.notification.notification--hiding {
  opacity: 0;
  transform: translateX(calc(100% + 24px));
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ── Header row ── */
.notification__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  line-height: 1;
}

/* Icon color by kind */
.notification--info    .notification__icon { color: var(--color-info); }
.notification--success .notification__icon { color: var(--color-success); }
.notification--warning .notification__icon { color: var(--color-warning); }
.notification--error   .notification__icon { color: var(--color-danger); }
/* Icon color override: failed always uses danger regardless of kind */
.notification--failed .notification__icon { color: var(--color-danger); }

.notification__title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.notification__dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.notification__dismiss:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

/* ── Message ── */
.notification__message {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 5px;
  line-height: 1.45;
  padding-left: 24px;
}

/* ── Progress bar ── */
.notification__progress-track {
  margin-top: 8px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.notification__progress-fill {
  height: 100%;
  background: var(--color-info);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification--completed .notification__progress-fill { background: var(--color-success); }
.notification--failed    .notification__progress-fill { background: var(--color-danger); }
.notification--warning   .notification__progress-fill { background: var(--color-warning); }

.notification__progress-label {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: 3px;
  padding-right: 1px;
}

/* ── Spinner animation ── */
@keyframes icon-spin {
  to { transform: rotate(360deg); }
}

.icon-spin {
  animation: icon-spin 0.9s linear infinite;
  display: block;
}

/* ════════════════════════════════════════════
   Notification Bell (navbar dropdown)
   ════════════════════════════════════════════ */

/* ── Bell wrapper ── */
.notif-bell {
  position: relative;
}

/* ── Bell trigger button ── */
.notif-bell__trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.notif-bell__trigger:hover {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}

.notif-bell__trigger[aria-expanded="true"] {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}

/* ── Badge dot ── */
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: var(--color-danger);
  border-radius: 8px;
  border: 2px solid var(--color-surface);
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  color: #fff;
  text-align: center;
  display: none;
  pointer-events: none;
  box-sizing: border-box;
}

.notif-badge--visible {
  display: block;
}

/* ── Bell dropdown panel ── */
.notif-bell__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 0 8px 32px rgba(0,0,0,.10);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Panel header ── */
.notif-bell__header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.notif-bell__header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

/* ── Scrollable list ── */
.notif-bell__list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.notif-bell__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Individual bell item ── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  transition: background 0.1s;
}

.notif-item:hover {
  background: var(--color-bg);
}

/* Unread items: subtle left accent */
.notif-item--pending,
.notif-item--in-progress {
  background: color-mix(in srgb, var(--color-info) 4%, transparent);
}

/* ── Item icon ── */
.notif-item__icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-text-muted);
}

.notif-item--info    .notif-item__icon { color: var(--color-info); }
.notif-item--success .notif-item__icon { color: var(--color-success); }
.notif-item--warning .notif-item__icon { color: var(--color-warning); }
.notif-item--error   .notif-item__icon { color: var(--color-danger); }
.notif-item--failed  .notif-item__icon { color: var(--color-danger); }

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

.notif-item__header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.notif-item__title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
}

.notif-item__dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.notif-item:hover .notif-item__dismiss {
  opacity: 1;
}

.notif-item__dismiss:hover {
  color: var(--color-text);
  background: var(--color-border);
}

.notif-item__message {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 3px;
  line-height: 1.45;
}

/* ── Progress bar inside bell item ── */
.notif-item__progress-track {
  margin-top: 7px;
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.notif-item__progress-fill {
  height: 100%;
  background: var(--color-info);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-item--completed .notif-item__progress-fill { background: var(--color-success); }
.notif-item--failed    .notif-item__progress-fill { background: var(--color-danger); }

/* ── Timestamp ── */
.notif-item__time {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 5px;
}

/* ── Mobile: bottom sheet ── */
@media (max-width: 639px) {
  /* Dismiss X always visible — no hover on touch screens */
  .notif-item__dismiss {
    opacity: 1;
  }

  .notif-bell__panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 75dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }
}

/* ── Fix popup hub so it clears the navbar (height: 56px + 1px border = 57px) ── */
#notifications-hub {
  top: calc(57px + 12px);
}
