/* =====================================================================
   News: panel + popup window (ClientApp/Shell/News.ts).
   The panel reuses the messages drawer (.erp-msg, erp-messages.css).
   Tokens only - works in every theme, RTL/LTR.
   ===================================================================== */

@media screen {

.erp-news.is-manage { width: min(520px, 100vw); }

/* ---------------------------------------------------------------- list */
.erp-news__list { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--erp-bg); }
.erp-news__item {
    overflow: hidden;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
}
.erp-news__img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: var(--erp-gray-100); }
.erp-news__content { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.erp-news__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.erp-news__kind {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--erp-primary-50);
    color: var(--erp-primary-text, var(--erp-primary));
    font-size: 11.5px;
    font-weight: 700;
}
.erp-news__kind[data-kind="2"] { background: var(--erp-warning-bg); color: var(--erp-warning); }
.erp-news__kind[data-kind="3"] { background: var(--erp-info-bg); color: var(--erp-info); }
.erp-news__date { font-size: 11.5px; color: var(--erp-text-muted); }
.erp-news__title { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--erp-gray-900); }
.erp-news__summary { margin: 0; font-size: 13px; line-height: 1.6; color: var(--erp-text); white-space: pre-wrap; }

/* developer rows */
.erp-news__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--erp-text-muted); }
.erp-news__state { font-weight: 700; }
.erp-news__state[data-state="live"] { color: var(--erp-success); }
.erp-news__state[data-state="soon"] { color: var(--erp-info); }
.erp-news__state[data-state="ended"], .erp-news__state[data-state="off"] { color: var(--erp-text-muted); }
.erp-news__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.erp-news .erp-btn.erp-news__del { color: var(--erp-danger) !important; }

/* ---------------------------------------------------------------- developer form */
.erp-news__form { background: var(--erp-surface); }
.erp-news__field { display: flex; flex-direction: column; gap: 4px; }
.erp-news__hint { color: var(--erp-text-muted); font-size: 11.5px; }
.erp-news__dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.erp-news__img-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    overflow: hidden;
    border: 1px dashed var(--erp-border);
    border-radius: var(--erp-radius);
    background: var(--erp-gray-50);
    color: var(--erp-text-muted);
    font-size: 12.5px;
}
.erp-news__img-box img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.erp-news__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.erp-news__file:focus-visible + .erp-news__img-actions label { box-shadow: var(--erp-focus); }
.erp-news__img-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.erp-news__img-actions label { margin: 0; cursor: pointer; }

/* ---------------------------------------------------------------- popup window */
.erp-news-pop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--erp-overlay, rgba(15, 23, 42, .5));
    opacity: 0;
    transition: opacity .2s ease;
}
.erp-news-pop.is-open { opacity: 1; }
.erp-news-pop__dialog {
    width: min(520px, 100%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface);
    color: var(--erp-text);
    box-shadow: var(--erp-shadow-lg);
    font-family: var(--erp-font);
    transform: translateY(8px) scale(.98);
    transition: transform .2s ease;
}
.erp-news-pop.is-open .erp-news-pop__dialog { transform: none; }
.erp-news-pop__dialog:focus { outline: none; }
.erp-news-pop__img { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.erp-news-pop__content { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.erp-news-pop__title { margin: 0; font-size: 19px; font-weight: 800; color: var(--erp-gray-900); }
.erp-news-pop__body { font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.erp-news-pop__actions { align-self: stretch; display: flex; justify-content: flex-end; margin-top: 6px; }

@media (max-width: 479.98px) {
    .erp-news__dates { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .erp-news-pop, .erp-news-pop__dialog { transition: none; }
}

}
