/* ============================================================
   page-errors.css - the JavaScript error RIBBON
   (wwwroot/js/page-errors.js builds the DOM).

   A full-width diagnostic strip pinned to the bottom of the window.
   It is deliberately identical in light and dark mode: it is a
   diagnostic surface, not page chrome, and must stay legible over both
   themes. The bar is always ONE line (the newest error, ellipsised so a
   long message cannot push the buttons off screen); Details opens the
   scrollable list ABOVE the bar, so the strip grows upward from the
   bottom edge and never covers more than about a third of the window.
   ============================================================ */

.page-errors-ribbon {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483000;            /* above every dialog in the app */
    display: flex;                  /* the script switches flex / none */
    flex-direction: column;
    background: rgba(22, 22, 28, 0.97);
    color: #e8e8ec;
    border-top: 2px solid #b03a3a;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.42);
    font-family: inherit;
    font-size: 12px;
}

/* ---- the always-visible summary line ---- */
.page-errors-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 14px;
    min-height: 34px;
    box-sizing: border-box;
}

.page-errors-icon {
    flex: 0 0 auto;
    color: #ff8f8f;
    font-size: 14px;
    line-height: 1;
}

.page-errors-count {
    flex: 0 0 auto;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(255, 143, 143, 0.16);
    color: #ffb4b4;
    font-weight: 700;
    white-space: nowrap;
}

/* The newest error: message, then its source. min-width:0 is what lets the
   message ellipsise instead of stretching the bar. */
.page-errors-latest {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.page-errors-msg {
    flex: 0 1 auto;
    min-width: 0;
    font-weight: 600;
    color: #ffc9c9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-errors-src {
    flex: 0 0 auto;
    max-width: 40%;
    font-family: Consolas, Menlo, monospace;
    font-size: 11px;
    color: #a9a9b6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-errors-btn {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: #d7d7de;
    font: inherit;
    font-size: 11.5px;
    padding: 3px 10px;
    cursor: pointer;
    white-space: nowrap;
}
.page-errors-btn:hover { background: rgba(255, 255, 255, 0.1); }

.page-errors-close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #cfcfd6;
    font-family: inherit;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}
.page-errors-close:hover { background: rgba(255, 255, 255, 0.12); color: #ffffff; }

/* ---- the list (Details) ---- */
.page-errors-list {
    max-height: 34vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(16, 16, 21, 0.6);
}

.page-error-row {
    padding: 7px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.page-error-row:last-child { border-bottom: none; }

.page-error-msg {
    font-weight: 600;
    color: #ffc9c9;
    word-break: break-word;
    white-space: pre-wrap;
}

.page-error-count {
    display: inline-block;
    margin-left: 8px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(255, 180, 180, 0.14);
    font-size: 11px;
    font-weight: 700;
}

.page-error-src {
    margin-top: 3px;
    font-family: Consolas, Menlo, monospace;
    font-size: 11px;
    color: #b9b9c4;
    word-break: break-all;
}

.page-error-meta {
    display: flex;
    gap: 10px;
    margin-top: 3px;
    font-size: 10.5px;
    color: #8d8d99;
}
.page-error-kind { color: #a9a9b6; }
.page-error-time { font-variant-numeric: tabular-nums; }

/* The off-screen textarea the Copy button falls back to when the async
   clipboard API is unavailable (plain HTTP, older browsers). */
.page-errors-copy-src {
    position: fixed;
    top: 0;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

@media print {
    .page-errors-ribbon { display: none !important; }
}
