/**
 * BrikPanel — BrikControl Styles
 *
 * Two scopes:
 *  1. .brikpanel-bc-wrap   → main page (admin.php?page=brikpanel-brikcontrol)
 *  2. .brikpanel-bc-*      → topbar button (loaded everywhere)
 *
 * Design system reuses --bp-* tokens from brikpanel-dashboard.css. We only
 * declare the missing warning tone here so the topbar can stand on
 * its own when the dashboard CSS isn't loaded.
 */

:root {
    --bp-warning: #b8860b;
    --bp-warning-bg: #fdf6e3;
    --bp-warning-border: #f0d590;
    --bp-success-bg: #e4f5e1;
    --bp-error-bg: #fce4e4;
    --bp-error-border: #f1b0b0;
    /* Text in a status colour: the dot, border and badge fills keep the bright
       tone, words take a darker one that reads at 4.5:1 on white, the grey
       figure boxes and the tinted badges alike. */
    --bp-warning-text: #8a6100;
    --bp-success-text: #1a6b15;
    --bp-error-text: #b42318;
}

/* =============================================================================
   PAGE WRAPPER
   Width, gutters and top spacing: the narrow page shell
   (front-end/shared/brikpanel-ui.css, `brikpanel-shell__page`).
   ============================================================================= */
.brikpanel-bc-wrap {
    padding-bottom: 1.5rem;
    color: #303030;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
}

.brikpanel-bc-wrap *, .brikpanel-bc-wrap *::before, .brikpanel-bc-wrap *::after {
    box-sizing: border-box;
}

/* The title keeps a real column: when the scan button (its "queued" label is
   long in Turkish and Russian) does not fit beside it, the button moves under
   the title instead of squeezing it (field test B10). */
.brikpanel-bc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.brikpanel-bc-header-left {
    flex: 1 1 16rem;
    min-width: 0;
}

.brikpanel-bc-header-right {
    flex: 0 0 auto;
    max-width: 100%;
    margin-inline-start: auto;
}

.brikpanel-bc-title {
    font-size: var(--brikpanel-title-size, 1.125rem);
    font-weight: var(--brikpanel-title-weight, 600);
    line-height: var(--brikpanel-title-line, 1.3);
    padding: 0;
    margin: 0 0 0.25rem 0;
    color: #303030;
}

.brikpanel-bc-subtitle {
    font-size: 0.8125rem;
    color: #616161;
    margin: 0;
}

.brikpanel-bc-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
    font-family: inherit;
}

.brikpanel-bc-button-primary {
    background: #303030;
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.brikpanel-bc-button-primary:hover:not(:disabled) {
    background: #1a1a1a;
}

.brikpanel-bc-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.brikpanel-bc-button-primary:active:not(:disabled) {
    transform: translateY(1px);
}

/* =============================================================================
   SUMMARY CARD
   ============================================================================= */
/* Equal tiles: all in one row while each fits, 2 x 2 with a Pending tile,
   otherwise a short list (front-end/shared/brikpanel-tiles.js, data-bp-tiles).
   Growing flex chips wrapped 2 + 1 on a phone and stretched the last one, OK,
   across the card (field test C10). The template is the look without the
   script. */
.brikpanel-bc-summary-card {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
}

.brikpanel-bc-summary-chip {
    min-width: 0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    border: 1px solid transparent;
}

.brikpanel-bc-chip-num {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
}

.brikpanel-bc-chip-label {
    font-size: var(--brikpanel-label-size, 0.8125rem);
    font-weight: var(--brikpanel-label-weight, 550);
    color: #616161;
    text-transform: var(--brikpanel-caps-case, none);
    letter-spacing: var(--brikpanel-caps-track, normal);
}

.brikpanel-bc-chip-critical { background: var(--bp-error-bg); border-color: var(--bp-error-border); }
.brikpanel-bc-chip-critical .brikpanel-bc-chip-num { color: var(--bp-error-text); }
.brikpanel-bc-chip-warning { background: var(--bp-warning-bg); border-color: var(--bp-warning-border); }
.brikpanel-bc-chip-warning .brikpanel-bc-chip-num { color: var(--bp-warning-text); }
.brikpanel-bc-chip-ok { background: var(--bp-success-bg); border-color: #b7e1b0; }
.brikpanel-bc-chip-ok .brikpanel-bc-chip-num { color: var(--bp-success-text); }
.brikpanel-bc-chip-unknown { background: #f7f7f7; border-color: #e3e3e3; }
.brikpanel-bc-chip-unknown .brikpanel-bc-chip-num { color: #616161; }
/* A count of zero is not an alert: "0 warnings" was a yellow tile and read as
   a problem (field test D5). Colour only a chip that counts something. */
.brikpanel-bc-summary-chip.is-zero { background: #f7f7f7; border-color: #e3e3e3; }
.brikpanel-bc-summary-chip.is-zero .brikpanel-bc-chip-num { color: #616161; }

/* A phone keeps the three tiles in a row: less padding around and inside. */
@media (max-width: 782px) {
    .brikpanel-bc-wrap .brikpanel-bc-summary-card {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .brikpanel-bc-wrap .brikpanel-bc-summary-chip {
        padding: 0.625rem;
    }

    .brikpanel-bc-wrap .brikpanel-bc-chip-label {
        font-size: 0.75rem;
    }
}

/* The list: one line per state, its name first and the count at the end. */
.brikpanel-bc-summary-card.is-tiles-list {
    gap: 0.375rem;
}

.brikpanel-bc-summary-card.is-tiles-list .brikpanel-bc-summary-chip {
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.brikpanel-bc-summary-card.is-tiles-list .brikpanel-bc-chip-num {
    font-size: 1.125rem;
}

/* =============================================================================
   PROGRESS
   ============================================================================= */
.brikpanel-bc-progress {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.brikpanel-bc-progress[hidden] {
    display: none;
}

.brikpanel-bc-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 550;
    color: #303030;
}

.brikpanel-bc-progress-track {
    height: 6px;
    background: #f1f1f1;
    border-radius: 3px;
    overflow: hidden;
}

.brikpanel-bc-progress-bar {
    height: 100%;
    background: #303030;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* =============================================================================
   CHECK CARDS
   ============================================================================= */
.brikpanel-bc-checks {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brikpanel-bc-card {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.brikpanel-bc-card-critical { border-left: 3px solid #d72c0d; }
.brikpanel-bc-card-warning { border-left: 3px solid var(--bp-warning); }
.brikpanel-bc-card-ok { border-left: 3px solid #1a8917; }
.brikpanel-bc-card-unknown { border-left: 3px solid #c0c0c0; }

.brikpanel-bc-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.brikpanel-bc-card-head-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.brikpanel-bc-card-title {
    font-size: var(--brikpanel-card-title-size, 0.9375rem);
    font-weight: var(--brikpanel-card-title-weight, 600);
    margin: 0;
    color: #303030;
}

.brikpanel-bc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 550;
    text-transform: none;
    letter-spacing: normal;
}

.brikpanel-bc-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    display: inline-block;
}

.brikpanel-bc-status-critical { background: var(--bp-error-bg); color: var(--bp-error-text); }
.brikpanel-bc-status-critical .brikpanel-bc-status-dot { background: #d72c0d; }
.brikpanel-bc-status-warning { background: var(--bp-warning-bg); color: var(--bp-warning-text); }
.brikpanel-bc-status-warning .brikpanel-bc-status-dot { background: var(--bp-warning); }
.brikpanel-bc-status-ok { background: var(--bp-success-bg); color: var(--bp-success-text); }
.brikpanel-bc-status-ok .brikpanel-bc-status-dot { background: #1a8917; }
.brikpanel-bc-status-unknown { background: #f1f1f1; color: #616161; }
.brikpanel-bc-status-unknown .brikpanel-bc-status-dot { background: #c0c0c0; }

.brikpanel-bc-card-score {
    display: flex;
    align-items: baseline;
    gap: 0.125rem;
    color: #616161;
    font-weight: 550;
}

.brikpanel-bc-score-num {
    font-size: 1.25rem;
    font-weight: 600;
    color: #303030;
}

.brikpanel-bc-score-suffix {
    font-size: 0.75rem;
    color: #616161;
}

.brikpanel-bc-card-summary {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #303030;
}

.brikpanel-bc-card-message {
    margin: 0 0 0.75rem 0;
    color: #616161;
    font-size: 0.8125rem;
}

/* Active plugins pills */
.brikpanel-bc-active-plugins {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
    color: #616161;
}

.brikpanel-bc-active-plugins-label {
    font-weight: 550;
    color: #303030;
}

.brikpanel-bc-plugin-pill {
    background: var(--bp-success-bg);
    color: var(--bp-success-text);
    border: 1px solid #b7e1b0;
    padding: 0.125rem 0.5rem;
    border-radius: 0.625rem;
    font-size: 0.75rem;
    font-weight: 550;
}

/* Recommendations */
.brikpanel-bc-recommendations {
    list-style: none;
    margin: 0.75rem 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* The text keeps at least 14rem; with less room the button goes under it, at
   the end. It sat beside the text and squeezed it into a narrow column on a
   phone (field test C10). */
.brikpanel-bc-rec {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.625rem;
    padding: 0.625rem 0.75rem;
    background: #fafafa;
    border: 1px solid #e3e3e3;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: #303030;
    line-height: 1.5;
}

.brikpanel-bc-rec-prio {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    margin-top: 0.4375rem;
    flex-shrink: 0;
    background: #c0c0c0;
}

.brikpanel-bc-rec-high .brikpanel-bc-rec-prio { background: #d72c0d; }
.brikpanel-bc-rec-medium .brikpanel-bc-rec-prio { background: var(--bp-warning); }
.brikpanel-bc-rec-low .brikpanel-bc-rec-prio { background: #1a8917; }

.brikpanel-bc-rec-text {
    flex: 1 1 14rem;
    min-width: 0;
}

/* A recommendation's buttons (the shared .brikpanel-btn): one link, or one
   per plugin in a single row (field test E6: three rows that differed by one
   word). They sit at the end of the row and wrap under the text when short of
   room, never squeezing it. */
.brikpanel-bc-rec-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
    max-width: 100%;
    margin-inline-start: auto;
}

/* Stats grid */
.brikpanel-bc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0 0 0;
    padding: 0.75rem;
    background: #fafafa;
    border-radius: 0.5rem;
    border: 1px solid #e3e3e3;
}

.brikpanel-bc-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.25rem 0.5rem;
}

.brikpanel-bc-stat-num {
    font-size: 1.125rem;
    font-weight: 600;
    color: #303030;
    line-height: 1.1;
}

.brikpanel-bc-stat-label {
    font-size: var(--brikpanel-label-size, 0.8125rem);
    color: #616161;
    text-transform: var(--brikpanel-caps-case, none);
    font-weight: var(--brikpanel-label-weight, 550);
    letter-spacing: var(--brikpanel-caps-track, normal);
    /* One line per label: side by side, a label that wrapped left the row
       ragged (field test E7). A label that does not fit makes the tiles
       script (data-bp-tiles) choose fewer columns or the list. */
    white-space: nowrap;
}

/* Figures of a check as a list when they do not fit side by side (data-bp-tiles). */
.brikpanel-bc-stats.is-tiles-list {
    gap: 0.25rem;
}

.brikpanel-bc-stats.is-tiles-list .brikpanel-bc-stat {
    flex-direction: row-reverse;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

/* In the list each label has its own row: it may wrap. */
.brikpanel-bc-stats.is-tiles-list .brikpanel-bc-stat-label {
    white-space: normal;
}

.brikpanel-bc-stat-warn .brikpanel-bc-stat-num { color: var(--bp-warning-text); }
.brikpanel-bc-stat-good .brikpanel-bc-stat-num { color: var(--bp-success-text); }
.brikpanel-bc-stat-error .brikpanel-bc-stat-num { color: var(--bp-error-text); }

/* Per-check repair action */
.brikpanel-bc-card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.875rem;
}

.brikpanel-bc-fix-result {
    font-size: 0.75rem;
    color: #616161;
}

/* Largest images table */
.brikpanel-bc-details {
    margin-top: 0.875rem;
    background: #fafafa;
    border: 1px solid #e3e3e3;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.brikpanel-bc-details summary {
    cursor: pointer;
    font-weight: 550;
    font-size: 0.8125rem;
    color: #303030;
    padding: 0.25rem 0;
    user-select: none;
}

.brikpanel-bc-details summary:hover {
    color: #1a1a1a;
}

.brikpanel-bc-largest-table {
    width: 100%;
    margin-top: 0.5rem;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.brikpanel-bc-largest-table th,
.brikpanel-bc-largest-table td {
    /* start, not left: right to left the cells read from the right. */
    text-align: start;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #e3e3e3;
}

.brikpanel-bc-largest-table th {
    font-weight: var(--brikpanel-th-weight, 600);
    color: #616161;
    font-size: var(--brikpanel-th-size, 0.75rem);
    text-transform: var(--brikpanel-caps-case, none);
    letter-spacing: var(--brikpanel-caps-track, normal);
    background: #fff;
}

.brikpanel-bc-largest-table tr:last-child td {
    border-bottom: none;
}

.brikpanel-bc-largest-table a {
    color: #303030;
    text-decoration: none;
    font-weight: 550;
}

.brikpanel-bc-largest-table a:hover {
    text-decoration: underline;
}

.brikpanel-bc-table-link {
    font-size: 0.75rem;
    color: #616161 !important;
}

/* The box scrolls only as a last resort: a table that does not fit turns
   its rows into cards (brikpanel-fit-table.js, field test B6). */
.brikpanel-bc-table-wrap {
    overflow-x: auto;
}

.brikpanel-bc-largest-table .brikpanel-bc-nowrap {
    white-space: nowrap;
}

/* Stacked rows keep the table's own 0.5rem inset so the text lines up
   with the table mode and a link's focus ring stays inside the box. */
.brikpanel-bc-details .brikpanel-bc-largest-table.is-stacked {
    --bp-fit-tile: 7rem;
}

.brikpanel-bc-details .brikpanel-bc-largest-table.is-stacked > tbody > tr:not([hidden]) {
    gap: 0.5rem 1rem;
    padding: 0.625rem 0.5rem;
}

/* Row buttons in the sample tables (3.3.34): "Real day", "Unmark". At the
   row's end in table mode; on a line of their own once the rows stack. */
.brikpanel-bc-largest-table .brikpanel-bc-sample-cell {
    text-align: end;
    white-space: nowrap;
}

.brikpanel-bc-details .brikpanel-bc-largest-table.is-stacked .brikpanel-bc-sample-cell {
    text-align: start;
}

/* What a row button did, under the card's lists; out of the layout while empty. */
.brikpanel-bc-card .brikpanel-bc-sample-result {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: #616161;
}

.brikpanel-bc-card .brikpanel-bc-sample-result:empty {
    display: none;
}

/* Products with missing images (3.3.37): under where the image was shown,
   the missing files' names or how many images; and the line under a list
   cut short. */
.brikpanel-bc-missing-detail {
    display: block;
    font-size: 0.75rem;
    color: #616161;
}

.brikpanel-bc-list-note {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.75rem;
    color: #616161;
}

/* Card footer */
.brikpanel-bc-card-foot {
    margin-top: 0.875rem;
    padding-top: 0.625rem;
    border-top: 1px solid #f1f1f1;
}

.brikpanel-bc-card-meta {
    font-size: 0.75rem;
    color: #616161;
}

.brikpanel-bc-empty-state {
    text-align: center;
    color: #616161;
    padding: 2rem 1rem;
}

/* =============================================================================
   TOPBAR BUTTON
   ============================================================================= */
.brikpanel-bc-btn {
    position: relative;
}

.brikpanel-bc-state-ok { color: #616161; }
.brikpanel-bc-state-warning { color: var(--bp-warning); }
.brikpanel-bc-state-critical { color: #d72c0d; }

.brikpanel-bc-state-warning .brikpanel-bc-badge { background: var(--bp-warning); }
.brikpanel-bc-state-critical .brikpanel-bc-badge { background: #d72c0d; }

.brikpanel-bc-dropdown {
    min-width: 320px;
}

.brikpanel-bc-last-scan {
    font-size: 0.75rem;
    color: #616161;
    font-weight: 400;
}

.brikpanel-bc-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.brikpanel-bc-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid #f1f1f1;
}

.brikpanel-bc-row:last-of-type {
    border-bottom: none;
}

.brikpanel-bc-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.4rem;
}

.brikpanel-bc-dot-critical { background: #d72c0d; }
.brikpanel-bc-dot-warning  { background: var(--bp-warning); }
.brikpanel-bc-dot-ok       { background: #1a8917; }
.brikpanel-bc-dot-unknown  { background: #c0c0c0; }

.brikpanel-bc-row-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.brikpanel-bc-row-label {
    font-size: 0.8125rem;
    font-weight: 550;
    color: #303030;
}

.brikpanel-bc-row-summary {
    font-size: 0.75rem;
    color: #616161;
    line-height: 1.4;
}

.brikpanel-bc-empty {
    padding: 1rem 0.875rem;
    color: #616161;
    font-size: 0.8125rem;
    text-align: center;
}

.brikpanel-bc-dropdown-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    border-top: 1px solid #e3e3e3;
    background: #fafafa;
    gap: 0.5rem;
}

.brikpanel-bc-rescan-btn {
    background: none;
    border: 1px solid #e3e3e3;
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 550;
    color: #303030;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s ease;
}

.brikpanel-bc-rescan-btn:hover:not(:disabled) {
    background: #f1f1f1;
}

.brikpanel-bc-rescan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.brikpanel-bc-report-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #303030 !important;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 550;
}

.brikpanel-bc-report-link:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

