/* ── Notification Popup Overlay ───────────────────────────────────────────── */

.wn-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
    pointer-events: none;
    transition: background .25s ease;
}

.wn-overlay--visible {
    background: rgba(0, 0, 0, .5);
    pointer-events: auto;
}

.wn-overlay--hiding {
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
}

/* ── Popup card ───────────────────────────────────────────────────────────── */

.wn-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .22);
    width: 100%;
    max-width: 580px;
    border-left: 5px solid transparent;
    opacity: 0;
    transform: scale(.93) translateY(14px);
    transition: opacity .25s ease, transform .25s ease;
}

.wn-overlay--visible .wn-popup {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.wn-overlay--hiding .wn-popup {
    opacity: 0;
    transform: scale(.93) translateY(14px);
}

.wn-popup--info    { border-left-color: #2980b9; }
.wn-popup--warning { border-left-color: #f39c12; }
.wn-popup--error   { border-left-color: #c0392b; }
.wn-popup--success { border-left-color: #27ae60; }

/* ── Popup header ─────────────────────────────────────────────────────────── */

.wn-popup-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 14px;
}

.wn-popup-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    line-height: 1;
}

.wn-popup--info    .wn-popup-icon { color: #2980b9; }
.wn-popup--warning .wn-popup-icon { color: #e67e22; }
.wn-popup--error   .wn-popup-icon { color: #c0392b; }
.wn-popup--success .wn-popup-icon { color: #27ae60; }

.wn-popup-title {
    flex: 1;
    font-weight: 700;
    font-size: 1.05rem;
    color: #212529;
    min-width: 0;
}

.wn-popup-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #6c757d;
    padding: 5px 8px;
    border-radius: 5px;
    line-height: 1;
    transition: background .12s, color .12s;
}

.wn-popup-close:hover { background: #f1f3f5; color: #212529; }

/* ── Popup content ────────────────────────────────────────────────────────── */

.wn-popup-content {
    padding: 0 20px 22px;
    font-size: .93rem;
    color: #495057;
    line-height: 1.65;
}

.wn-popup-content p:first-child { margin-top: 0; }
.wn-popup-content p:last-child  { margin-bottom: 0; }
.wn-popup-content ul, .wn-popup-content ol { margin: 6px 0; padding-left: 20px; }
.wn-popup-content a { color: inherit; text-decoration: underline; }

/* ── API Disruption Banner — fixed, centered, above everything ───────────── */

.api-disruption-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99000;

    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: min(380px, calc(100vw - 32px));

    background: #fdedec;
    border: 1px solid #f1948a;
    border-left: 4px solid #c0392b;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
    padding: 10px 16px;

    color: #7b241c;
    font-size: .85rem;
    line-height: 1.45;
    white-space: nowrap;
}

.api-disruption-banner__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.api-disruption-banner__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    white-space: normal;
}

.api-disruption-banner__title {
    font-weight: 700;
    font-size: .85rem;
}

.api-disruption-banner__text {
    font-size: .82rem;
    opacity: .88;
}

@media print {
    .api-disruption-banner { display: none; }
}

/* ── Wiki Notification Banners (admin preview) ────────────────────────────── */

.wiki-notifications {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.wiki-notification {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid transparent;
    position: relative;
    line-height: 1.5;
    font-size: .92rem;
}

/* ── Types ────────────────────────────────────────────────────────────────── */

.wn-info    { background: #e8f4fd; border-left-color: #2980b9; color: #1a4f7a; }
.wn-warning { background: #fef9e7; border-left-color: #f39c12; color: #7d5c00; }
.wn-error   { background: #fdedec; border-left-color: #c0392b; color: #7b241c; }
.wn-success { background: #eafaf1; border-left-color: #27ae60; color: #1a5e34; }

/* ── Icon ─────────────────────────────────────────────────────────────────── */

.wn-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */

.wn-body {
    flex: 1;
    min-width: 0;
}

.wn-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.wn-content p:first-child { margin-top: 0; }
.wn-content p:last-child  { margin-bottom: 0; }
.wn-content ul, .wn-content ol { margin: 6px 0; padding-left: 20px; }
.wn-content a { color: inherit; text-decoration: underline; }

/* ── Close button ─────────────────────────────────────────────────────────── */

.wn-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: .5;
    padding: 0 4px;
    color: inherit;
    line-height: 1;
    align-self: flex-start;
    transition: opacity .12s;
}

.wn-close:hover { opacity: 1; }

/* ── Notification Manager Admin UI ───────────────────────────────────────── */

#notification-manager {
    font-family: inherit;
    color: var(--fm-text, #212529);
}

.nm-shell {
    background: #fff;
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 8px;
    overflow: hidden;
}

.nm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
    gap: 12px;
    flex-wrap: wrap;
}

.nm-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.nm-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nm-empty {
    padding: 40px;
    text-align: center;
    color: var(--fm-muted, #6c757d);
    font-size: .9rem;
    font-style: italic;
}

/* ── Notification card in admin list ─────────────────────────────────────── */

.nm-card {
    border: 1px solid var(--fm-border, #e2e6ea);
    border-left: 4px solid;
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.nm-card--info    { border-left-color: #2980b9; }
.nm-card--warning { border-left-color: #f39c12; }
.nm-card--error   { border-left-color: #c0392b; }
.nm-card--success { border-left-color: #27ae60; }

.nm-card-body { flex: 1; min-width: 0; }

.nm-card-title {
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nm-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: .78rem;
    color: var(--fm-muted, #6c757d);
    margin-top: 4px;
}

.nm-badge {
    background: var(--fm-bg, #f8f9fa);
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: .72rem;
    white-space: nowrap;
}

.nm-badge--active {
    background: #eafaf1;
    border-color: #a9dfbf;
    color: #1a5e34;
    font-weight: 600;
}

.nm-badge--expired {
    background: #f9ebea;
    border-color: #f1948a;
    color: #7b241c;
}

.nm-badge--scheduled {
    background: #fef9e7;
    border-color: #f9d175;
    color: #7d5c00;
}

.nm-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.nm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.nm-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
}

.nm-modal-title { font-weight: 600; font-size: 1rem; }

.nm-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--fm-muted, #6c757d); padding: 2px 8px;
    border-radius: 4px;
}
.nm-modal-close:hover { background: var(--fm-bg, #f8f9fa); }

.nm-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nm-modal-foot {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--fm-border, #e2e6ea);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Form elements ────────────────────────────────────────────────────────── */

.nm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .nm-row { grid-template-columns: 1fr; } }

.nm-field { display: flex; flex-direction: column; gap: 5px; }

.nm-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--fm-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.nm-input, .nm-select {
    padding: 8px 10px;
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 6px;
    font-size: .9rem;
    font-family: inherit;
    color: var(--fm-text, #212529);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}

.nm-input:focus, .nm-select:focus {
    outline: none;
    border-color: var(--fm-accent, #1a6bb5);
    box-shadow: 0 0 0 3px rgba(26,107,181,.12);
}

/* ── Wiki checkboxes ──────────────────────────────────────────────────────── */

.nm-wikis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nm-wiki-check {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: .875rem;
    user-select: none;
}

.nm-wiki-check input { cursor: pointer; }

/* ── TinyMCE wrapper ──────────────────────────────────────────────────────── */

.nm-editor-wrap { border: 1px solid var(--fm-border, #e2e6ea); border-radius: 6px; overflow: hidden; }
