/* aishaa news (AI-1817): the news window, the archive on the support page and the
   communication admin. Global on purpose: most of it styles MudBlazor components,
   which scoped CSS does not reach. */

/* ----- the news window ----- */

.news-dialog .mud-dialog-title {
    padding-bottom: 4px;
}

.news-dialog__heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 32px; /* room for the close button */
}

.news-dialog__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

.news-dialog__logo {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.news-dialog__dot {
    opacity: 0.6;
}

.news-dialog__important {
    margin: 0 0 0 4px;
    height: 20px;
}

.news-dialog__title {
    line-height: 1.3;
    font-weight: 600;
}

.news-dialog__content {
    max-height: min(68vh, 760px);
    overflow-y: auto;
    padding-top: 8px;
}

.news-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 4px 8px 4px 16px;
}

.news-dialog__useful {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
}

.news-dialog__useful > span {
    margin-right: 6px;
}

.news-dialog__buttons {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}

.news-content img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 640px) {
    .news-dialog.mud-dialog {
        margin: 8px;
        max-height: calc(100dvh - 16px);
    }

    .news-dialog__content {
        max-height: calc(100dvh - 210px);
    }

    .news-dialog__actions {
        padding-left: 8px;
    }

    .news-dialog__buttons {
        width: 100%;
    }

    .news-dialog__buttons .mud-button-root {
        flex: 1 1 auto;
    }
}

/* ----- the archive (support page) ----- */

.news-archive__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.news-archive__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background: var(--mud-palette-surface);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: border-color 120ms ease, background 120ms ease;
}

.news-archive__item:hover,
.news-archive__item:focus-visible {
    border-color: color-mix(in srgb, var(--mud-palette-primary), transparent 50%);
    background: color-mix(in srgb, var(--mud-palette-primary), transparent 96%);
    outline: none;
}

.news-archive__marker {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
}

.news-archive__item--new .news-archive__marker {
    background: var(--mud-palette-primary);
}

.news-archive__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.news-archive__title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-archive__item:not(.news-archive__item--new) .news-archive__title {
    font-weight: 500;
}

.news-archive__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

.news-archive__badge {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: color-mix(in srgb, var(--mud-palette-primary), transparent 88%);
    color: var(--mud-palette-primary);
}

.news-archive__badge--important {
    background: color-mix(in srgb, var(--mud-palette-warning), transparent 84%);
    color: var(--mud-palette-warning-darken, var(--mud-palette-warning));
}

.news-archive__chevron {
    flex: 0 0 auto;
    color: var(--mud-palette-text-secondary);
}

.news-archive__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 16px;
    text-align: center;
}

/* ----- communication admin ----- */

.news-admin__toolbar,
.news-admin__actions,
.news-admin__options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.news-admin__options .mud-select {
    max-width: 380px;
}

.news-admin__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.news-admin__row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    background: var(--mud-palette-surface);
    cursor: pointer;
}

.news-admin__row:hover,
.news-admin__row:focus-visible {
    border-color: color-mix(in srgb, var(--mud-palette-primary), transparent 50%);
    outline: none;
}

.news-admin__main {
    flex: 1 1 auto;
    min-width: 0;
}

.news-admin__title {
    font-weight: 600;
    margin-bottom: 4px;
}

.news-admin__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

.news-admin__meta .mud-chip {
    margin: 0;
}

.news-admin__reach {
    display: grid;
    grid-template-columns: 64px 64px 120px;
    gap: 4px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.news-admin__reach:hover,
.news-admin__reach:focus-visible {
    background: color-mix(in srgb, var(--mud-palette-primary), transparent 92%);
    outline: none;
}

.news-admin__reach-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.news-admin__reach-cell strong {
    font-size: 14px;
    color: var(--mud-palette-text-primary);
}

.news-admin__reach-cell small {
    font-size: 11px;
}

.news-admin__ai-helper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: rgba(91, 33, 208, 0.04);
    border: 1px solid rgba(91, 33, 208, 0.12);
    border-radius: 8px;
}

.news-admin__languages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.news-admin__flag {
    width: 18px;
    height: 13px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: -2px;
}

.news-admin__preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.news-admin__preview-stage {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 18px;
    overflow-x: auto;
    background: rgba(91, 33, 208, 0.04);
    border: 1px solid rgba(91, 33, 208, 0.1);
    border-radius: 10px;
}

.news-admin__preview {
    display: block;
    flex: 0 0 auto;
    height: 640px;
    background: #fff;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(30, 30, 30, 0.08);
    transition: width 160ms ease;
}

/* The news window is a medium dialog: preview at that width, not full screen. */
.news-admin__preview--desktop {
    width: min(100%, 900px);
}

.news-admin__preview--mobile {
    width: min(390px, 100%);
}

@media (max-width: 640px) {
    .news-admin__ai-helper,
    .news-admin__preview-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .news-admin__preview-stage {
        padding: 8px;
    }

    .news-admin__reach {
        display: none;
    }
}

/* ----- numbers ----- */

.news-stats__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.news-stats__tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
}

.news-stats__value {
    font-size: 20px;
    font-weight: 600;
}

.news-stats__label {
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

.news-stats__section {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 560px;
}

.news-stats__bar {
    display: grid;
    grid-template-columns: 110px 1fr 56px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.news-stats__bar-track {
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mud-palette-primary), transparent 90%);
    overflow: hidden;
}

.news-stats__bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--mud-palette-primary);
}

.news-stats__bar-value {
    text-align: right;
    color: var(--mud-palette-text-secondary);
}

.news-stats__breakdowns {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.news-stats__breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.news-stats__breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    padding: 3px 0;
    border-bottom: 1px dashed var(--mud-palette-lines-default);
}

.news-stats__breakdown-row span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-admin__tabs {
    display: flex;
}

/* A small segmented switch (Bericht/Cijfers, Desktop/Mobiel): a soft track with the chosen
   option as a raised pill inside it, the same height for every option. */
.news-segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mud-palette-primary), transparent 92%);
}

.news-segmented__item {
    border: 0;
    border-radius: 999px;
    padding: 6px 16px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.news-segmented__item:hover {
    color: var(--mud-palette-text-primary);
}

.news-segmented__item:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--mud-palette-primary), transparent 40%);
    outline-offset: 1px;
}

.news-segmented__item--active,
.news-segmented__item--active:hover {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-primary);
    box-shadow: 0 1px 3px rgba(30, 30, 60, 0.14);
}

.news-segmented--small .news-segmented__item {
    padding: 4px 12px;
    font-size: 13px;
}
