/* Notification settings page.
   Namespaced with .ns- to avoid collisions; loaded globally via App.razor.

   Design intent: calm surfaces (hairline border + soft shadow), one card per surface area, and a
   scannable list of rows inside each card (no nested boxes). Mirrors the admin-statistics quality bar.
   Colors come from --mud-palette-* so light and dark both work. */

/* ---- Section (Account / Profile) ---- */
.ns-section {
    margin-bottom: 32px;
}

.ns-section:last-child {
    margin-bottom: 0;
}

.ns-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 10px;
}

.ns-section__heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ns-section__icon {
    flex: 0 0 auto;
    color: var(--mud-palette-primary);
}

.ns-section__titles {
    min-width: 0;
}

.ns-section__title {
    font-weight: 700;
    line-height: 1.2;
}

.ns-section__actions {
    flex: 0 1 auto;
    min-width: 240px;
}

/* ---- Honest channel legend ---- */
.ns-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--mud-palette-text-secondary);
}

.ns-legend__icon {
    flex: 0 0 auto;
    opacity: 0.7;
}

/* ---- Area cards ---- */
.ns-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ns-card {
    box-sizing: border-box;
    padding: 14px 18px 6px;
    border-radius: 16px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ns-card:hover {
    border-color: var(--mud-palette-lines-inputs);
    box-shadow: 0 3px 10px rgba(16, 24, 40, 0.07);
}

.ns-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.ns-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-action-default-hover); /* fallback if color-mix unsupported */
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
}

.ns-card__title {
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
}

/* ---- Rows (one notification type) ---- */
.ns-rows {
    display: flex;
    flex-direction: column;
}

.ns-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.ns-row:last-child {
    border-bottom: none;
}

.ns-row__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ns-row__name {
    font-size: 0.9rem;
    line-height: 1.3;
    color: var(--mud-palette-text-primary);
}

.ns-row__desc {
    font-size: 0.78rem;
    line-height: 1.3;
    margin-top: 2px;
    color: var(--mud-palette-text-secondary);
}

.ns-row__email {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.ns-row__email-na {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

/* Keep the switch label compact and consistent within the row. */
.ns-row__email .mud-switch {
    margin: 0;
}

/* ---- Sticky save bar (per section) ---- */
.ns-actions {
    position: sticky;
    bottom: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 10px 0;
    background: var(--mud-palette-background);
    border-top: 1px solid var(--mud-palette-lines-default);
}

.ns-actions__chip {
    margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .ns-section {
        margin-bottom: 24px;
    }

    .ns-section__actions {
        flex-basis: 100%;
        min-width: 0;
    }

    .ns-card {
        padding: 12px 14px 4px;
    }

    /* Stack the email control under the type name on narrow screens. */
    .ns-row {
        align-items: flex-start;
        gap: 4px;
        flex-direction: column;
    }

    .ns-row__email {
        width: 100%;
        min-height: 44px;
    }
}
