/*
  WTW Notifications admin page — scoped styles for the redesigned Notifications table.
  Consumes design tokens from wtw-sds-tokens.css. All selectors are scoped under
  cms-notifications-* to avoid broad MudBlazor overrides; no !important is used.
*/

.cms-notifications-page {
  font-family: var(--wtw-sds-font-family-sans-serif);
  color: var(--wtw-sds-color-base-825);
}

.cms-notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.cms-notifications-title {
  font-size: var(--wtw-sds-font-size-xl);
  font-weight: var(--wtw-sds-font-weight-semibold);
  color: var(--wtw-sds-color-base-825);
  margin: 0;
}

.cms-admin-shell .cms-notifications-create:not(:disabled):not([aria-disabled="true"]) {
  background: var(--wtw-brand-color-success-550);
  color: #ffffff;
  min-height: 44px;
  font-weight: var(--wtw-sds-button-font-weight, 400);
}

.cms-admin-shell .cms-notifications-create:not(:disabled):not([aria-disabled="true"]):hover {
  background: var(--wtw-brand-color-success-600);
}

.cms-admin-shell .cms-notifications-create:focus-visible {
  outline: var(--wtw-sds-focus-outline-width) solid var(--wtw-sds-focus-outline-color);
  outline-offset: 3px;
}

/* Responsive table: preserve a real semantic <table> and let it scroll horizontally rather
   than collapsing to cards, per the Figma desktop authority. */
.cms-notifications-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.cms-notifications-table {
  width: 100%;
  border-collapse: collapse;
}

.cms-notifications-table th,
.cms-notifications-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--wtw-sds-color-base-125);
  font-size: var(--wtw-sds-font-size-sm);
}

.cms-notifications-table th {
  color: var(--wtw-sds-color-base-600);
  font-weight: var(--wtw-sds-font-weight-semibold);
}

.cms-notifications-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  background: none;
  border: none;
  padding: 0 0.25rem;
  font: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
}

.cms-notifications-sort-button:focus-visible {
  outline: var(--wtw-sds-focus-outline-width) solid var(--wtw-sds-focus-outline-color);
  outline-offset: 2px;
}

.cms-notifications-sort-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.cms-notifications-schedule {
  display: flex;
  flex-direction: column;
  line-height: var(--wtw-sds-line-height-min);
}

.cms-notifications-schedule__time {
  color: var(--wtw-sds-color-base-600);
  font-size: var(--wtw-sds-font-size-xs);
}

.cms-notifications-schedule--empty {
  color: var(--wtw-sds-color-base-550);
}

/* Type badges */

.cms-notifications-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: var(--wtw-sds-font-size-xs);
  font-weight: var(--wtw-sds-font-weight-medium);
  border: 1px solid transparent;
}

.cms-notifications-type-badge--alert {
  background: var(--wtw-sds-color-error-50);
  color: var(--wtw-sds-color-error-600);
  border-color: var(--wtw-sds-color-error-600);
}

.cms-notifications-type-badge--brand {
  background: var(--wtw-brand-color-ultraviolet-50);
  color: var(--wtw-brand-color-ultraviolet-600);
  border-color: var(--wtw-brand-color-ultraviolet-600);
}

.cms-notifications-type-badge--information {
  background: var(--wtw-sds-color-stratosphere-50);
  color: var(--wtw-sds-color-stratosphere-600);
  border-color: var(--wtw-sds-color-stratosphere-600);
}

.cms-notifications-type-badge--warning {
  background: var(--wtw-sds-color-submarine-50);
  color: var(--wtw-sds-color-submarine-600);
  border-color: var(--wtw-sds-color-submarine-600);
}

.cms-notifications-type-badge--neutral {
  background: var(--wtw-sds-color-base-50);
  color: var(--wtw-sds-color-base-600);
  border-color: var(--wtw-sds-color-base-200);
}

/* Actions */

.cms-notifications-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cms-notifications-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
}

.cms-notifications-action-button:focus-visible {
  outline: var(--wtw-sds-focus-outline-width) solid var(--wtw-sds-focus-outline-color);
  outline-offset: 2px;
}

.cms-notifications-action-button--preview {
  border-color: var(--wtw-sds-color-ui-550);
  color: var(--wtw-sds-color-ui-550);
  background: #ffffff;
}

.cms-notifications-action-button--preview:hover {
  background: var(--wtw-sds-color-ui-125);
}

.cms-notifications-action-button--edit {
  background: var(--wtw-sds-color-ui-550);
  color: #ffffff;
}

.cms-notifications-action-button--edit:hover {
  background: var(--wtw-sds-color-ui-600);
}

/* Empty / loading / error states */

.cms-notifications-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 2rem 1rem;
  color: var(--wtw-sds-color-base-600);
}

.cms-notifications-state--error {
  color: var(--wtw-sds-color-error-600);
}

/* Narrow viewport (Figma breakpoint): keep the semantic table, scroll horizontally. */
@media (max-width: 45em) {
  .cms-notifications-header {
    flex-direction: column;
    align-items: stretch;
  }

  .cms-notifications-table th,
  .cms-notifications-table td {
    white-space: nowrap;
  }
}

/* Mock alignment (Figma screenshot): page header, plain table, compact actions */

.cms-notifications-page {
  padding: 1.5rem 0.5rem 0;
}

.cms-notifications-header {
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--wtw-sds-color-base-125);
}

.cms-notifications-header__title {
  margin: 0;
}

.cms-notifications-create {
  border-radius: 6px;
  padding: 0 1.25rem;
  text-transform: none;
}

.cms-notifications-table th {
  color: var(--wtw-sds-color-base-825);
  font-size: 1rem;
  border-bottom: 2px solid var(--wtw-sds-color-base-200);
}

.cms-notifications-table td {
  font-size: 1rem;
  padding: 1rem;
  vertical-align: middle;
  color: var(--wtw-sds-color-base-825);
}

.cms-notifications-table th:nth-child(3),
.cms-notifications-table td:nth-child(3),
.cms-notifications-table th:nth-child(4),
.cms-notifications-table td:nth-child(4) {
  text-align: right;
}

.cms-notifications-actions-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.cms-notifications-table td:last-child {
  width: 1%;
}

.cms-notifications-sort-button {
  min-height: 32px;
}

.cms-notifications-sort-icon {
  color: var(--wtw-sds-color-base-550);
  font-size: 1rem;
}

.cms-notifications-table tbody tr:last-child td {
  border-bottom: 1px solid var(--wtw-sds-color-base-125);
}

.cms-notifications-schedule {
  align-items: flex-end;
}

.cms-notifications-schedule__time {
  font-size: 0.875rem;
}

/* Type is plain text in the mock, not a pill */
.cms-notifications-type-badge,
.cms-notifications-type-badge--alert,
.cms-notifications-type-badge--brand,
.cms-notifications-type-badge--information,
.cms-notifications-type-badge--warning,
.cms-notifications-type-badge--neutral {
  display: inline;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.cms-notifications-actions {
  justify-content: flex-end;
}

.cms-notifications-action-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--wtw-sds-color-ui-550);
}

/* Mock alignment: name column takes the remaining width; Type, Start and End shrink to
   their content so they sit close together. */
.cms-notifications-table th:nth-child(2),
.cms-notifications-table td:nth-child(2),
.cms-notifications-table th:nth-child(3),
.cms-notifications-table td:nth-child(3),
.cms-notifications-table th:nth-child(4),
.cms-notifications-table td:nth-child(4) {
  width: 1%;
  white-space: nowrap;
}

.cms-notifications-table th:nth-child(2),
.cms-notifications-table td:nth-child(2) {
  padding-right: 2.5rem;
}

.cms-notifications-table th:nth-child(4),
.cms-notifications-table td:nth-child(4) {
  padding-right: 5.5rem;
}

/* Preview modal (PBI 22051) */

.cms-preview-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.cms-preview-dialog__heading {
  font-weight: var(--wtw-sds-font-weight-semibold);
  color: var(--wtw-sds-color-base-825);
}

.cms-preview-dialog__name {
  color: var(--wtw-sds-color-base-600);
}

.cms-preview-dialog__close {
  margin: -0.5rem -0.5rem 0 0;
}

.cms-preview-dialog__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}

.cms-preview-section__label {
  margin: 0 0 0.5rem;
  font-size: var(--wtw-sds-font-size-sm);
  font-weight: var(--wtw-sds-font-weight-regular);
  color: var(--wtw-sds-color-base-825);
}

.cms-preview-banner {
  --cms-preview-cta-background: var(--wtw-sds-color-base-825);
  --cms-preview-cta-color: #ffffff;
  display: flex;
  align-items: flex-start;
  font-family: var(--wtw-sds-font-family-sans-serif);
  font-size: 14px;
  line-height: 1.43;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.cms-preview-banner__icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: -2px;
}

.cms-preview-banner__body {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cms-preview-banner__title {
  margin: 0 0 4px;
  font-weight: var(--wtw-sds-font-weight-semibold);
}

.cms-preview-banner__text {
  margin: 0;
}

.cms-preview-banner__text p {
  margin: 0;
}

.cms-preview-banner__text p + p {
  margin-top: 4px;
}

.cms-preview-banner .cms-preview-banner__text a,
.cms-preview-banner .cms-preview-banner__text a:link,
.cms-preview-banner .cms-preview-banner__text a:visited {
  color: #0b5cd5;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

.cms-preview-banner .cms-preview-banner__text a:hover {
  color: #084aa8;
}

.cms-preview-banner__text ul,
.cms-preview-banner__text ol {
  margin: 4px 0;
  padding-left: 24px;
}

.cms-preview-banner__text ul {
  list-style: disc outside;
}

.cms-preview-banner__text ol {
  list-style: decimal outside;
}

/* Quill saves both bullet and numbered lists as <ol>, distinguishing them only
   via the per-item data-list attribute. Show dots for bullet items. */
.cms-preview-banner__text li[data-list="bullet"] {
  list-style-type: disc;
  counter-increment: list-item 0;
}

.cms-preview-banner__text li[data-list="ordered"] {
  list-style-type: decimal;
}

.cms-preview-banner__text li {
  margin: 2.4px 0;
}

.cms-preview-banner__text > :last-child {
  margin-bottom: 0;
}

.cms-preview-banner__text li:last-child {
  margin-bottom: 0;
}

.cms-preview-banner__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.cms-preview-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 16px;
  border: 1px solid;
  border-radius: 8px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  font-weight: var(--wtw-sds-font-weight-medium);
  font-size: inherit;
  line-height: 1.5;
  text-decoration: none;
}

a.cms-preview-banner__cta {
  cursor: pointer;
}

a.cms-preview-banner__cta:hover {
  text-decoration: underline;
}

a.cms-preview-banner__cta:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.cms-preview-banner__cta--primary {
  border-color: var(--cms-preview-cta-border, var(--cms-preview-cta-background));
  background: var(--cms-preview-cta-background);
  color: var(--cms-preview-cta-color);
}

.cms-preview-banner__cta--secondary {
  border-color: currentColor;
  background: #ffffff;
  color: inherit;
}

.cms-preview-banner__dismiss {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: inherit;
}

.cms-preview-banner__dismiss svg {
  width: 20px;
  height: 20px;
}

.cms-preview-banner--alert {
  --cms-preview-cta-background: var(--wtw-sds-color-error-600);
  background: var(--wtw-sds-color-error-50);
  border-color: var(--wtw-sds-color-error-600);
  color: var(--wtw-sds-color-error-600);
}

.cms-preview-banner--brand {
  --cms-preview-cta-background: var(--wtw-brand-color-ultraviolet-600);
  background: var(--wtw-brand-color-ultraviolet-50);
  border-color: var(--wtw-brand-color-ultraviolet-600);
  color: var(--wtw-brand-color-ultraviolet-600);
}

.cms-preview-banner--information {
  --cms-preview-cta-background: var(--wtw-sds-color-stratosphere-600);
  background: var(--wtw-sds-color-stratosphere-50);
  border-color: var(--wtw-sds-color-stratosphere-600);
  color: var(--wtw-sds-color-stratosphere-600);
}

.cms-preview-banner--warning {
  --cms-preview-cta-background: #ffeab6;
  --cms-preview-cta-color: var(--wtw-sds-color-submarine-600);
  --cms-preview-cta-border: var(--wtw-sds-color-submarine-600);
  background: var(--wtw-sds-color-submarine-50);
  border-color: var(--wtw-sds-color-submarine-600);
  color: var(--wtw-sds-color-submarine-600);
}

.cms-preview-banner--neutral {
  background: var(--wtw-sds-color-base-50);
  border-color: var(--wtw-sds-color-base-200);
  color: var(--wtw-sds-color-base-825);
}
