/* ─────────────────────────────────────────
   CSS VARIABLES — light theme
   Legacy var names preserved so ALL
   JS-rendered inline styles resolve correctly:
   var(--green), var(--red), var(--amber),
   var(--blue), var(--text0), var(--text2), etc.
───────────────────────────────────────── */
:root {
    /* Surfaces */
    --void:    #f5f9f8;
    --bg1:     #ffffff;
    --bg2:     #f5f9f8;
    --bg3:     #eaf4f1;
    --bg4:     #e1f5ee;

    /* Brand */
    --brand:      #4eb39a;
    --brand-dark: #3a9b83;
    --brand-deep: #0e2d27;

    /* Semantic — used heavily in JS-rendered HTML */
    --green:   #16a34a;
    --green2:  #15803d;
    --green-d: rgba(22,163,74,0.08);
    --green-b: rgba(22,163,74,0.2);
    --red:     #dc2626;
    --red-d:   rgba(220,38,38,0.08);
    --amber:   #d97706;
    --amber-d: rgba(217,119,6,0.08);
    --blue:    #2563eb;
    --blue-d:  rgba(37,99,235,0.08);
    --purple:  #7c3aed;

    /* Borders */
    --border:  rgba(78,179,154,0.18);
    --border2: rgba(78,179,154,0.35);

    /* Text — used in JS inline styles */
    --text0:   #1a2e2b;
    --text1:   #3a9b83;
    --text2:   #5f7a74;
    --text3:   #94aaa6;

    /* Font stacks — DM Sans/Mono loaded by header.php */
    --mono:    'DM Mono', monospace;
    --exo:     'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─────────────────────────────────────────
   PAGE WRAPPER
───────────────────────────────────────── */
.ac-page {
    font-family: 'DM Sans', sans-serif;
    background: var(--void);
    min-height: 100vh;
    color: var(--text0);
    overflow-x: hidden;
}

/* ─────────────────────────────────────────
   HERO — dark gradient matching site pattern
   (replaces the custom .ac-header + .ac-hero)
───────────────────────────────────────── */
.ac-hero {
    background: linear-gradient(145deg, #0e2d27 0%, #1a4a3d 60%, #0e3530 100%);
    border-bottom: 1px solid rgba(78,179,154,0.2);
    padding: 2.25rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}
.ac-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 80% at 75% 50%, rgba(78,179,154,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.ac-hero-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Status chips in hero */
.ac-status-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.ac-status-chip {
    font-family: var(--mono);
    font-size: 0.62rem;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid;
    letter-spacing: .05em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
}
.ac-status-chip.green {
    color: #6fd1b3;
    border-color: rgba(111,209,179,.3);
    background: rgba(78,179,154,0.1);
}
.ac-status-chip.amber {
    color: #fcd34d;
    border-color: rgba(252,211,77,.3);
    background: rgba(252,211,77,0.08);
}
.ac-status-chip.red {
    color: #fca5a5;
    border-color: rgba(252,165,165,.3);
    background: rgba(252,165,165,0.08);
}
.pulse {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.7)} }

/* Hero text */
.ac-hero-tag {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: #6fd1b3;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: .6rem;
    opacity: .9;
}
.ac-updated-line {
    font-family: var(--mono); font-size: 0.62rem; color: rgba(255,255,255,0.35);
    margin-bottom: .5rem; letter-spacing: .01em;
}
.ac-updated-line time { color: rgba(255,255,255,0.55); font-weight: 600; }
.ac-hero h1, .ac-hero h2 {
    font-size: clamp(1.3rem, 3.5vw, 2rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -.02em;
    margin-bottom: .5rem;
}
.ac-hero h1 em, .ac-hero h2 em { font-style: normal; color: #6fd1b3; }
.ac-hero p { font-size: 0.875rem; color: rgba(255,255,255,0.5); line-height: 1.75; max-width: 520px; }

/* Score ring in hero */
.ac-overall-score { text-align: center; flex-shrink: 0; }
.score-ring-wrap { position: relative; width: 110px; height: 110px; }
.score-ring-wrap svg { width: 110px; height: 110px; }
.score-ring-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    pointer-events: none;
}
.score-num {
    font-family: var(--mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.score-lbl {
    font-family: var(--mono);
    font-size: 0.58rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: .06em;
    margin-top: 2px;
}
.score-grade-lbl {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: rgba(255,255,255,0.4);
    margin-top: .4rem;
    letter-spacing: .05em;
}

/* ─────────────────────────────────────────
   MAIN LAYOUT
───────────────────────────────────────── */
.ac-main {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2rem;
}

/* ─────────────────────────────────────────
   CONFIG PANEL — white card
───────────────────────────────────────── */
.config-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow .2s;
}
.config-panel:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.config-head {
    padding: .9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #f5f9f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.config-head-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: #3a9b83;
    letter-spacing: .1em;
    text-transform: uppercase;
    display: flex; align-items: center; gap: 8px;
}
.config-head-title svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

.config-body {
    padding: 1.25rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.config-field { display: flex; flex-direction: column; gap: 5px; }
.config-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text2);
    letter-spacing: .07em;
    text-transform: uppercase;
}
.config-input {
    background: #f5f9f8;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text0);
    outline: none;
    transition: border-color .2s, background .2s;
}
.config-input:focus { border-color: var(--brand); background: #fff; }
.config-input::placeholder { color: var(--text3); }
.config-select {
    background: #f5f9f8;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text0);
    outline: none;
    cursor: pointer;
    transition: border-color .2s;
}
.config-select:focus { border-color: var(--brand); }

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn-run {
    background: #4eb39a;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0e2d27;
    cursor: pointer;
    transition: background .15s, transform .12s, box-shadow .15s;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-run:hover { background: #3a9b83; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(78,179,154,0.3); }
.btn-run:active { transform: scale(.98); }
.btn-run:disabled { background: #e1f5ee; color: #94aaa6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-run svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

.btn-sec {
    background: transparent;
    border: 1px solid rgba(78,179,154,0.3);
    border-radius: 8px;
    padding: 9px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    display: inline-flex; align-items: center; gap: 7px;
}
.btn-sec:hover { border-color: var(--brand); color: var(--brand-dark); background: #e1f5ee; }
.btn-sec svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ─────────────────────────────────────────
   SECTION TITLE — matches site pattern
───────────────────────────────────────── */
.sec-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text2);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sec-title::after { content: ''; flex: 1; height: 1px; background: rgba(78,179,154,0.15); }

/* ─────────────────────────────────────────
   PROGRESS BAR
───────────────────────────────────────── */
.progress-bar-wrap {
    height: 3px;
    background: #eaf4f1;
    border-radius: 99px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    opacity: 0;
    transition: opacity .3s;
}
.progress-bar-wrap.show { opacity: 1; }
.progress-bar-fill {
    height: 100%;
    background: #4eb39a;
    border-radius: 99px;
    transition: width .4s ease;
}

/* ─────────────────────────────────────────
   CHECK CARDS — white with coloured left bar
───────────────────────────────────────── */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}
.check-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
    position: relative;
}
.check-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
.check-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--text3);
    transition: background .4s;
}
.check-card.pass::before    { background: #16a34a; }
.check-card.fail::before    { background: #dc2626; }
.check-card.warn::before    { background: #d97706; }
.check-card.running::before { background: #2563eb; animation: runningBar 1s ease-in-out infinite alternate; }
@keyframes runningBar { from{opacity:.4} to{opacity:1} }

.check-card-head {
    padding: .9rem 1.1rem .9rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.check-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    background: #f5f9f8;
    transition: background .3s;
}
.check-card.pass .check-icon { background: rgba(22,163,74,0.08); }
.check-card.fail .check-icon { background: rgba(220,38,38,0.08); }
.check-card.warn .check-icon { background: rgba(217,119,6,0.08); }

.check-info { flex: 1; min-width: 0; }
.check-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text0);
    margin-bottom: 2px;
}
.check-summary {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status badges — light-bg colours */
.check-badge {
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 4px;
    letter-spacing: .06em;
    text-transform: uppercase;
    flex-shrink: 0;
    border: 1px solid;
}
.badge-pass    { color: #166534; border-color: rgba(22,163,74,.3);   background: rgba(22,163,74,0.08); }
.badge-fail    { color: #991b1b; border-color: rgba(220,38,38,.3);   background: rgba(220,38,38,0.08); }
.badge-warn    { color: #92400e; border-color: rgba(217,119,6,.3);   background: rgba(217,119,6,0.08); }
.badge-running { color: #1e40af; border-color: rgba(37,99,235,.3);   background: rgba(37,99,235,0.08); animation: blink 1s ease-in-out infinite; }
.badge-pending { color: var(--text2); border-color: rgba(94,154,134,.25); background: transparent; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

.check-chevron { color: var(--text3); transition: transform .2s; flex-shrink: 0; }
.check-card.open .check-chevron { transform: rotate(90deg); }

.check-body {
    display: none;
    padding: .5rem 1.3rem 1.1rem;
    border-top: 1px solid var(--border);
}
.check-card.open .check-body { display: block; }

/* Sub-check rows */
.sub-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: .45rem 0;
    border-bottom: 1px solid rgba(78,179,154,0.07);
}
.sub-check:last-child { border-bottom: none; }
.sub-icon  { font-size: 0.75rem; flex-shrink: 0; margin-top: 1px; }
.sub-text  { flex: 1; }
.sub-name  { font-family: 'DM Sans', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--text0); }
.sub-detail{ font-family: var(--mono); font-size: 0.68rem; color: var(--text2); margin-top: 1px; line-height: 1.5; }
.sub-val   { font-family: var(--mono); font-size: 0.68rem; text-align: right; flex-shrink: 0; padding-top: 1px; }
.val-pass  { color: #16a34a; }
.val-fail  { color: #dc2626; }
.val-warn  { color: #d97706; }
.val-info  { color: #2563eb; }

/* Remediation tip — green tint box */
.remediation-tip {
    background: #f0fdf4;
    border: 1px solid rgba(22,163,74,0.2);
    border-radius: 6px;
    padding: .65rem .9rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: #065f46;
    line-height: 1.6;
    margin-top: .75rem;
}
.remediation-tip strong {
    color: #16a34a;
    display: block;
    margin-bottom: 2px;
    font-size: 0.6rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ─────────────────────────────────────────
   SYSTEM INFO CARDS
───────────────────────────────────────── */
.info-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}
.info-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .9rem 1rem;
    transition: box-shadow .2s;
}
.info-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.05); }
.info-card-lbl {
    font-family: var(--mono);
    font-size: 0.58rem;
    color: var(--text2);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .35rem;
}
.info-card-val {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text0);
    line-height: 1.2;
}
.info-card-sub {
    font-family: var(--mono);
    font-size: 0.62rem;
    color: var(--text3);
    margin-top: 2px;
}

/* ─────────────────────────────────────────
   REGION LATENCY TABLE
───────────────────────────────────────── */
.region-table-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.region-table-head {
    padding: .8rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f5f9f8;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: #3a9b83;
    letter-spacing: .1em;
    text-transform: uppercase;
    display: flex; align-items: center; gap: 8px;
}
.region-table-head svg { width: 13px; height: 13px; stroke: currentColor; fill: none; }

.rt { width: 100%; border-collapse: collapse; }
.rt th {
    padding: .5rem 1.25rem;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text2);
    background: #eaf4f1;
    border-bottom: 1px solid rgba(78,179,154,0.15);
}
.rt td {
    padding: .55rem 1.25rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text1);
    border-bottom: 1px solid rgba(78,179,154,0.06);
}
.rt tr:hover td { background: rgba(78,179,154,0.03); }
.rt tr:last-child td { border-bottom: none; }

.latency-bar-cell { width: 120px; }
.latency-bar  { height: 4px; background: #eaf4f1; border-radius: 99px; overflow: hidden; margin-top: 3px; }
.latency-fill { height: 100%; border-radius: 99px; transition: width .6s ease; }

/* ─────────────────────────────────────────
   REPORT PANEL
───────────────────────────────────────── */
.report-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    display: none;
}
.report-panel.show { display: block; }
.report-head {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f5f9f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}
.report-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: #3a9b83;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.report-body {
    padding: 1rem 1.25rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text1);
    line-height: 1.9;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    background: #0e2d27;
    color: #e1f5ee;
}

/* ─────────────────────────────────────────
   SEO / FAQ CARD
───────────────────────────────────────── */
.seo-block {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.75rem 2rem;
    margin-top: 2rem;
}
.seo-block h2 { font-size: 1.05rem; font-weight: 700; color: var(--text0); margin-bottom: .5rem; }
.seo-block > p { font-size: 0.875rem; color: var(--text2); line-height: 1.8; }
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    margin-top: 1.25rem;
}
.faq-card { background: #f5f9f8; border: 1px solid rgba(78,179,154,0.15); border-radius: 10px; padding: 1rem; }
.faq-q { font-size: 0.875rem; font-weight: 600; color: var(--text0); margin-bottom: .3rem; }
.faq-a { font-size: 0.82rem; color: var(--text2); line-height: 1.7; }

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
.ac-toast {
    position: fixed; bottom: 2rem; right: 2rem;
    background: #0e2d27;
    border: 1px solid rgba(78,179,154,0.35);
    border-radius: 8px;
    padding: .7rem 1.2rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: #e1f5ee;
    z-index: 999;
    transform: translateY(60px); opacity: 0;
    transition: all .3s; pointer-events: none;
}
.ac-toast.show { transform: translateY(0); opacity: 1; }

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 700px) {
    .ac-hero-inner  { grid-template-columns: 1fr; }
    .ac-hero        { padding: 1.75rem 1.25rem 1.5rem; }
    .ac-main        { padding: 1rem; }
    .check-grid     { grid-template-columns: 1fr; }
    .config-body    { grid-template-columns: 1fr; }
    .seo-block      { padding: 1.25rem; }
}
