/*
 * BrowserBot dashboard - woodystraction theme.
 * Charcoal (#25282a) text on white, orange (#f37021) brand accent, with
 * PageSpeed-style severity (green / amber / red) kept for pass/warn/fail.
 * Matches the self-contained run report.
 */
:root {
    --font: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --c-text: #25282a; --c-black: #25282a;
    --c-beige: #f0f1f1; --c-sand: #f5f6f6; --c-white: #fff;
    --c-line: #e3e5e6; --c-line-soft: #eeeff0; --c-muted: #6b7073;

    /* brand accent (links, buttons, focus, brand mark) */
    --brand: #f37021; --brand-bg: #fdf0e8; --brand-line: #f8cfb4; --brand-dark: #d95f12;

    --good: #1f9d57; --good-bg: #e8f5ee; --good-line: #c2e4d1;
    --avg:  #E08600; --avg-bg:  #FCEFD7; --avg-line:  #F6D79A;
    --poor: #e23b2e; --poor-bg: #fbe6e4; --poor-line: #f4c3bd;

    --shadow: 0 1px 2px rgba(37, 40, 42, .05), 0 8px 24px rgba(37, 40, 42, .06);
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--c-white);
    color: var(--c-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .85em; background: var(--c-beige); color: var(--c-black); padding: 1px 6px; border-radius: 5px; word-break: break-word; }

.muted { color: var(--c-muted); }
.small { font-size: .82rem; }
.text-fail { color: var(--poor); }

/* top bar */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 60px;
    background: var(--c-white); border-bottom: 1px solid var(--c-line);
    position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 1.12rem; letter-spacing: -.01em; color: var(--c-text); display: inline-flex; align-items: center; gap: 9px; }
.brand::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); }
.brand:hover { text-decoration: none; }
.nav a { color: var(--c-muted); margin-left: 22px; font-size: .92rem; }
.nav a.is-active, .nav a:hover { color: var(--c-text); text-decoration: none; }

.container { max-width: 1040px; margin: 0 auto; padding: 32px 24px 72px; }

/* footer: brand dot + name, then a muted tagline behind a hairline rule */
.footer { display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--c-muted); padding: 28px; font-size: .8rem; }
.footer__brand { font-weight: 600; color: var(--c-text); display: inline-flex; align-items: center; gap: 8px; }
.footer__brand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.footer__tag { position: relative; padding-left: 14px; }
.footer__tag::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 12px; background: var(--c-line); }

/* passed/total counts: emphasised pass, muted total behind a hairline rule,
   failures as a soft red pill (replaces the bare "7/14" slash) */
.count { display: inline-flex; align-items: baseline; font-variant-numeric: tabular-nums; }
.count__pass { font-weight: 600; }
.count__total { color: var(--c-muted); font-size: .85em; margin-left: 9px; padding-left: 9px; border-left: 1px solid var(--c-line); }
.count__fail { margin-left: 10px; align-self: center; background: var(--poor-bg); color: var(--poor); border: 1px solid var(--poor-line); border-radius: 999px; padding: 1px 9px; font-size: .68rem; font-weight: 600; letter-spacing: .02em; }

h1 { font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 12px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.inline-run { margin: 0; }

/* "Run now" trigger (suite picker + button) */
.run-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.select {
    font-family: var(--font); font-size: .88rem; color: var(--c-text);
    background: var(--c-white); border: 1px solid var(--c-line); border-radius: 9px;
    padding: 8px 30px 8px 12px; cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F6A62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* summary cards */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.card { background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card__label { color: var(--c-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
.card__value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin-top: 7px; }
.card__value.small { font-size: .95rem; font-weight: 500; letter-spacing: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* panels */
.panel { background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 20px 22px; margin: 18px 0; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; }
.panel--error { border-color: var(--poor); }
.panel--error h2 { color: var(--poor); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--c-muted); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--c-line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--c-line-soft); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--c-sand); }

/* badges (PageSpeed-style soft tint, keyed by status word) */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.badge--passed, .badge--sent { background: var(--good-bg); color: var(--good); }
.badge--failed, .badge--error { background: var(--poor-bg); color: var(--poor); }
.badge--warning { background: var(--avg-bg); color: var(--avg); }
.badge--running { background: var(--good-bg); color: var(--good); }
.badge--skipped, .badge--unknown { background: var(--c-beige); color: var(--c-muted); }

/* chips */
.chip { display: inline-block; background: var(--c-beige); color: var(--c-muted); padding: 2px 9px; border-radius: 6px; font-size: .72rem; font-weight: 500; margin-left: 4px; }
.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chips .chip { margin: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--brand); color: var(--c-white); padding: 9px 18px; border-radius: 9px; font-size: .9rem; font-weight: 500; border: none; cursor: pointer; }
.btn:hover { text-decoration: none; background: var(--brand-dark); }
.btn--sm { padding: 6px 13px; font-size: .82rem; }
.btn--danger { background: var(--poor); }
.btn--danger:hover { background: #d63d00; }
.btn--ghost { background: var(--c-white); color: var(--c-text); border: 1px solid var(--c-line); }
.btn--ghost:hover { background: var(--c-sand); color: var(--c-text); }

/* diagnostics disclosure (run-detail per-test failure/log/screenshot panel) */
summary.diag__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; color: var(--c-text); }
summary.diag__head::before { align-self: center; }
summary.diag__head .test__name { font-weight: 600; }
.diag__sub { margin: 10px 0 0; }
.diag__sub > summary { font-size: .82rem; }
.diag__downloads { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; }
.diag__video { margin: 16px 0 0; }
.diag__video video { width: 100%; max-width: 760px; margin-top: 7px; border: 1px solid var(--c-line); border-radius: 10px; display: block; background: #000; }

/* inline SVG icons inherit text colour + size */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex: none; }
.text-good { color: var(--good); }
.text-warn { color: var(--avg); }

/* icon-only button (e.g. delete in a table row) */
.inline-form { display: inline; margin: 0; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-white); color: var(--c-muted); cursor: pointer; transition: color .12s, background .12s, border-color .12s; }
.icon-btn:hover { color: var(--c-white); background: var(--c-muted); border-color: var(--c-muted); }
.icon-btn--danger { color: var(--poor); border-color: var(--poor-line); }
.icon-btn--danger:hover { color: var(--c-white); background: var(--poor); border-color: var(--poor); }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* status banner */
.alert { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin: 16px 0; border: 1px solid transparent; }
.alert--success { background: var(--good-bg); border-color: var(--good-line); color: #0f7a43; }
.alert--error { background: var(--poor-bg); border-color: var(--poor-line); color: #a52a1f; }

/* in-app confirmation modal (replaces the browser's native confirm/alert) */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(31, 33, 33, .45); }
.modal-overlay[hidden] { display: none; }
.modal { width: 100%; max-width: 440px; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: 0 16px 50px rgba(31, 33, 33, .25); padding: 24px; animation: modal-in .14s ease-out; }
.modal__title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.modal__message { margin: 0 0 22px; color: var(--c-muted); font-size: .92rem; line-height: 1.5; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn--ghost { background: var(--c-white); color: var(--c-text); border: 1px solid var(--c-line); }
.btn--ghost:hover { background: var(--c-sand); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

/* settings JSON editors */
.editor { margin: 18px 0; }
.editor__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.code-editor { display: block; width: 100%; min-height: 360px; resize: vertical; font-family: var(--mono); font-size: .8rem; line-height: 1.55; color: var(--c-text); background: var(--c-sand); border: 1px solid var(--c-line); border-radius: 10px; padding: 14px 16px; white-space: pre; overflow: auto; tab-size: 2; }
.code-editor:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }

.empty { background: var(--c-white); border: 1px dashed var(--c-line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--c-muted); }

/* recent-failures list */
.failure-list { list-style: none; padding: 0; margin: 0; }
.failure-list li { padding: 11px 0; border-bottom: 1px solid var(--c-line-soft); }
.failure-list li:last-child { border-bottom: none; }

/* run meta definition list */
.meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; margin: 18px 0 26px; }
.meta div { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--c-line-soft); }
.meta dt { color: var(--c-muted); min-width: 84px; margin: 0; }
.meta dd { margin: 0; word-break: break-word; }

/* test cards (full border in severity colour - no left stripe) */
.test { background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px 20px; margin: 12px 0; box-shadow: var(--shadow); }
.test--passed { border-color: var(--good); }
.test--failed { border-color: var(--poor); }
.test--warning { border-color: var(--avg); }
.test--error { border-color: var(--poor); }
.test__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.test__name { font-weight: 600; }
.test__url { margin-top: 5px; word-break: break-all; }

/* failures */
.failures { margin: 12px 0; }
.failure { background: var(--poor-bg); border: 1px solid var(--poor-line); border-radius: 10px; padding: 13px 15px; margin: 10px 0; }
.failure__msg { font-weight: 600; color: var(--poor); margin-bottom: 8px; }
.kv { font-size: .85rem; border-collapse: collapse; }
.kv th { width: 96px; border: none; padding: 3px 10px 3px 0; vertical-align: top; color: var(--c-muted); font-weight: 500; }
.kv td { border: none; padding: 3px 10px 3px 0; word-break: break-word; }
.kv-label { width: 220px; }

/* disclosure widgets */
details { margin: 12px 0; }
summary { cursor: pointer; color: var(--c-muted); font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 7px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; flex: none; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
details[open] > summary::before { transform: rotate(45deg); }

/* logs */
.log { font-family: var(--mono); font-size: .78rem; background: var(--c-black); color: var(--c-beige); border-radius: 8px; padding: 12px 14px; margin: 8px 0 0; list-style: none; max-height: 260px; overflow: auto; }
.log li { padding: 2px 0; word-break: break-all; }

/* screenshots */
.shots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.shots img { width: 200px; height: auto; border: 1px solid var(--c-line); border-radius: 8px; display: block; }
.thumb { max-width: 300px; border: 1px solid var(--c-line); border-radius: 8px; margin-top: 8px; }

.pager { display: flex; align-items: center; gap: 16px; margin-top: 20px; }

@media (max-width: 820px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .meta { grid-template-columns: 1fr; }
}


/* Login page (standalone, no dashboard nav) */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 28px; }
.login-brand { font-weight: 600; letter-spacing: .02em; color: var(--c-muted); font-size: .82rem; text-transform: uppercase; }
.login-title { font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; margin: 5px 0 20px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; font-size: .8rem; color: var(--c-muted); font-weight: 500; }
.login-form input { padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 9px; font: inherit; font-size: .95rem; color: var(--c-text); background: var(--c-sand); }
.login-form input:focus { outline: none; border-color: var(--brand); background: var(--c-white); }
.login-form .btn { margin-top: 6px; width: 100%; justify-content: center; padding: 11px; }
.login-error { background: var(--poor-bg); color: var(--poor); border: 1px solid var(--poor-line); border-radius: 9px; padding: 10px 14px; font-size: .85rem; margin-bottom: 16px; }
.nav__logout { display: inline; margin: 0; }
.nav__logout-btn { background: none; border: none; color: var(--c-muted); margin-left: 22px; font-size: .92rem; font-family: inherit; cursor: pointer; padding: 0; }
.nav__logout-btn:hover { color: var(--c-text); }
