/* #1947 — email notification switches: /profile/ card, saved-searches hub rows, /email-settings/. */

/* ---- The switch ---------------------------------------------------------------------- */
.notify-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.notify-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.notify-switch__track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 100px;
  background-color: var(--color-grey-90);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.06);
  transition: background-color 0.18s ease;
}

.notify-switch__track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--color-white);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
  transition: transform 0.18s ease;
}

.notify-switch input:checked + .notify-switch__track {
  background-color: var(--color-blue-50);
}

.notify-switch input:checked + .notify-switch__track::before {
  transform: translateX(18px);
}

.notify-switch input:focus-visible + .notify-switch__track {
  outline: 2px solid var(--color-blue-50);
  outline-offset: 2px;
}

.notify-switch input:disabled + .notify-switch__track {
  opacity: 0.55;
}

.notify-switch.is-busy {
  cursor: progress;
}

/* "On" / "Off" word next to the kind switches, so the state reads without colour. */
.notify-switch__state {
  min-width: 2em;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-grey-50);
}

.notify-switch__state::after {
  content: attr(data-off);
}

.notify-switch input:checked ~ .notify-switch__state {
  color: var(--color-teal-deep);
}

.notify-switch input:checked ~ .notify-switch__state::after {
  content: attr(data-on);
}

.notify-switch__text {
  color: var(--color-grey-50);
  white-space: nowrap;
}

.notify-switch input:checked ~ .notify-switch__text {
  color: var(--color-teal-deep);
}

/* ---- ⓘ ------------------------------------------------------------------------------- */
.notify-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 0;
  background: none;
  cursor: help;
  vertical-align: middle;
  color: var(--color-grey-50);
}

.notify-info svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.notify-info:hover,
.notify-info:focus-visible {
  color: var(--color-teal-deep);
}

/* ---- Saved-state line ---------------------------------------------------------------- */
.notify-status {
  color: var(--color-green-40);
  font-weight: 600;
  transition: opacity 0.3s ease;
}

.notify-status.is-error {
  color: var(--color-red-40);
}

.notify-status:empty {
  opacity: 0;
}

/* ---- Kinds (profile card, /email-settings/) ------------------------------------------ */
.notify-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.notify-card__lede {
  margin: 0;
  color: var(--color-grey-50);
}

.notify-kinds {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.notify-kind {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-grey-90);
}

.notify-kind:first-child {
  border-top: 0;
  padding-top: 0;
}

.notify-kind:last-child {
  padding-bottom: 0;
}

.notify-kind__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.notify-kind__label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.notify-kind__label label {
  cursor: pointer;
}

.notify-kind__what {
  margin: 0;
  color: var(--color-grey-30, #3a3f48);
}

.notify-kind__count {
  margin: 0;
  color: var(--color-grey-50);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.notify-kind__manage {
  color: var(--color-teal-deep);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.notify-kind__manage:hover {
  text-decoration: underline;
}

.notify-kind .notify-switch {
  margin-top: 2px;
}

/* ---- Saved searches hub ---------------------------------------------------------------- */
.resources-actions .notify-hub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--space-md);
  margin-right: auto;
  margin-left: var(--space-lg);
}

.notify-hub__summary {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  color: var(--color-grey-50);
}

.notify-hub__bulk {
  padding: 0;
  min-height: 0;
  color: var(--color-teal-deep);
  font-weight: 600;
}

.resources-list.saved-searches-list .resources-list__item-email {
  grid-area: date;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 3;
}

.notify-paused {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  border: 1px solid #F3D48B;
  background-color: #FFF8E6;
}

.notify-paused p {
  margin: 0;
  color: #5C4400;
}

.notify-paused[hidden],
.notify-hub__bulk[hidden],
[data-notify-scope][hidden] {
  display: none;
}

/* ---- /email-settings/ ----------------------------------------------------------------- */
.notify-hero .hub-hero__who {
  padding: var(--space-sm) 0 var(--space-md);
}

.notify-page .hub-panel__body {
  max-width: 760px;
  margin: 0 auto;
}

.notify-done {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: 8px;
  border: 1px solid #B7E4C4;
  background-color: var(--color-green-95);
}

.notify-done__icon svg {
  width: 22px;
  height: 22px;
  fill: var(--color-green-40);
}

.notify-done__text {
  flex: 1;
  margin: 0;
}

.notify-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notify-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px 0;
  border-top: 1px solid var(--color-grey-90);
}

.notify-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.notify-item__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.notify-page__foot {
  margin: 0;
  text-align: center;
  color: var(--color-grey-50);
}

@media (max-width: 767px) {
  .resources-actions .notify-hub {
    order: 3;
    width: 100%;
    margin: var(--space-sm) 0 0;
  }

  .resources-list.saved-searches-list .resources-list__item {
    grid-template-areas: "title title"
      "email email"
      "actions actions";
  }

  .resources-list.saved-searches-list .resources-list__item-email {
    grid-area: email;
  }

  .notify-kind {
    gap: var(--space-md);
  }

  .notify-item .notify-switch__text {
    display: none;
  }
}

/* Kind switched off: the per-search switches keep their state but read as on hold. */
.is-paused .resources-list__item-email .notify-switch,
.is-paused .notify-item .notify-switch {
  opacity: 0.5;
}

/* #2466: /email-settings/ "What you follow" — group labels + Unfollow rows. */
.notify-items__group {
  margin: 16px 0 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}
.notify-item.is-unfollowed .notify-item__name {
  color: var(--color-grey-50);
  text-decoration: line-through;
}
.notify-unfollow { flex-shrink: 0; }
