/* aeo-audit: aeo-overview — per-page Overview rebuild (Round 22 Part 2).
 *
 * Used ONLY when page-detail.php?module=overview. The per-module render paths
 * (?module=ai_snippet, etc.) use aeo-finding.css + aeo-module-header.css from
 * Round 20b/21 — those files are unchanged.
 *
 * Single-column layout, max-width ~960px centered. Section gap 1.5rem.
 *
 * Tokens: existing severity hexes (#ef4444 / #f59e0b / #3b82f6 / #22c55e),
 * D-081 ScoreBand modifiers, brand purple via existing --bg-primary. NO new
 * color tokens introduced.
 */

/* ─── Outer wrapper ─────────────────────────────────────────────────────── */

.aeo-overview {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Round 22 Part 2.5 — Issue 1: max-width cap removed. The Overview body
     * now spans the full inner-column width to match analytics.php and the
     * per-module page-detail renders. The header card (outside this wrapper)
     * already spans full width; the prior 960px cap created a visual mismatch
     * where the body looked artificially narrower than the header above it. */
}

.aeo-overview__section {
    background-color: #ffffff;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.625rem;
    padding: 1.25rem 1.5rem;
}
:is(.dark .aeo-overview__section) {
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}

.aeo-overview__section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
}

.aeo-overview__section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(82 82 82);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
:is(.dark .aeo-overview__section-title) {
    color: rgb(212 212 212);
}

.aeo-overview__section-hint {
    font-size: 0.75rem;
    color: rgb(115 115 115);
}
:is(.dark .aeo-overview__section-hint) {
    color: rgb(163 163 163);
}

.aeo-overview__empty-note {
    font-size: 0.8125rem;
    font-style: italic;
    color: rgb(115 115 115);
    padding: 0.625rem 0.75rem;
    background-color: rgb(249 250 251);
    border: 1px dashed rgb(229 231 235);
    border-radius: 0.375rem;
    text-align: center;
    margin: 0;
}
:is(.dark .aeo-overview__empty-note) {
    color: rgb(163 163 163);
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}

/* ─── Section 2: stat tiles ──────────────────────────────────────────────── */

.aeo-overview__stat-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 0.75rem;
}

.aeo-overview__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgb(249 250 251);
    border: 1px solid rgb(229 231 235);
    text-align: center;
}
:is(.dark .aeo-overview__stat) {
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}

.aeo-overview__stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: rgb(23 23 23);
    letter-spacing: -0.02em;
}
:is(.dark .aeo-overview__stat-value) {
    color: #ffffff;
}

.aeo-overview__stat-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgb(115 115 115);
}
:is(.dark .aeo-overview__stat-label) {
    color: rgb(163 163 163);
}

/* AI Visibility tile — value text colored by score band. */
.aeo-overview__stat--vis.aeo-band--great   .aeo-overview__stat-value { color: #15803d; }
.aeo-overview__stat--vis.aeo-band--good    .aeo-overview__stat-value { color: #166534; }
.aeo-overview__stat--vis.aeo-band--ok      .aeo-overview__stat-value { color: #b45309; }
.aeo-overview__stat--vis.aeo-band--bad     .aeo-overview__stat-value { color: #b91c1c; }
.aeo-overview__stat--vis.aeo-band--pending .aeo-overview__stat-value { color: rgb(115 115 115); }
:is(.dark .aeo-overview__stat--vis.aeo-band--great)   .aeo-overview__stat-value { color: #4ade80; }
:is(.dark .aeo-overview__stat--vis.aeo-band--good)    .aeo-overview__stat-value { color: #86efac; }
:is(.dark .aeo-overview__stat--vis.aeo-band--ok)      .aeo-overview__stat-value { color: #fbbf24; }
:is(.dark .aeo-overview__stat--vis.aeo-band--bad)     .aeo-overview__stat-value { color: #fca5a5; }

.aeo-overview__stat--critical .aeo-overview__stat-value { color: #b91c1c; }
:is(.dark .aeo-overview__stat--critical) .aeo-overview__stat-value { color: #fca5a5; }
.aeo-overview__stat--passing  .aeo-overview__stat-value { color: #166534; }
:is(.dark .aeo-overview__stat--passing)  .aeo-overview__stat-value { color: #86efac; }

@media (max-width: 640px) {
    .aeo-overview__stat-tiles { grid-template-columns: 1fr; }
    .aeo-overview__stat-value { font-size: 1.25rem; }
}

/* ─── Section 3: 12-card flat module grid ────────────────────────────────── */

.aeo-overview__module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.aeo-overview__module-card {
    display: block;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgb(249 250 251);
    border: 1px solid rgb(229 231 235);
    text-decoration: none;
    color: inherit;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.aeo-overview__module-card:hover {
    background-color: rgb(243 244 246);
    border-color: var(--bg-primary, rgb(124 58 237));
}
:is(.dark .aeo-overview__module-card) {
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}
:is(.dark .aeo-overview__module-card):hover {
    background-color: rgb(48 48 48);
}

.aeo-overview__module-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.aeo-overview__module-card-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(64 64 64);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}
:is(.dark .aeo-overview__module-card-name) {
    color: rgb(212 212 212);
}

.aeo-overview__module-card-score {
    font-size: 0.875rem;
    font-weight: 700;
    color: rgb(23 23 23);
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
:is(.dark .aeo-overview__module-card-score) {
    color: #ffffff;
}

.aeo-overview__module-bar {
    height: 4px;
    background-color: rgb(229 231 235);
    border-radius: 2px;
    overflow: hidden;
}
:is(.dark .aeo-overview__module-bar) {
    background-color: rgb(64 64 64);
}
.aeo-overview__module-bar > span {
    display: block;
    height: 100%;
    border-radius: 2px;
    background-color: rgb(115 115 115); /* fallback */
    transition: width 0.4s cubic-bezier(.22,1,.36,1);
}
.aeo-overview__module-bar.aeo-band--great   > span { background-color: #22c55e; }
.aeo-overview__module-bar.aeo-band--good    > span { background-color: #3b82f6; }
.aeo-overview__module-bar.aeo-band--ok      > span { background-color: #f59e0b; }
.aeo-overview__module-bar.aeo-band--bad     > span { background-color: #ef4444; }
.aeo-overview__module-bar.aeo-band--pending > span { background-color: rgb(163 163 163); }

@media (max-width: 640px) {
    .aeo-overview__module-grid { grid-template-columns: 1fr; }
}

/* ─── Section 4: Top Critical / Quick Wins ───────────────────────────────── */

.aeo-overview__top-fixes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .aeo-overview__top-fixes { grid-template-columns: 1fr; }
}

.aeo-overview__top-fixes-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.aeo-overview__count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.25rem;
    padding: 0 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: rgb(243 244 246);
    color: rgb(82 82 82);
}
:is(.dark .aeo-overview__count-pill) {
    background-color: rgb(64 64 64);
    color: rgb(212 212 212);
}
.aeo-overview__count-pill--critical { background-color: #fee2e2; color: #b91c1c; }
:is(.dark .aeo-overview__count-pill--critical) { background-color: rgba(239,68,68,0.18); color: #fca5a5; }
.aeo-overview__count-pill--win      { background-color: #dcfce7; color: #166534; }
:is(.dark .aeo-overview__count-pill--win)      { background-color: rgba(34,197,94,0.18);  color: #86efac; }

/* Finding card → also a clickable link in the Overview context. */
.aeo-overview__finding-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.aeo-overview__finding-link:hover {
    border-color: var(--bg-primary, rgb(124 58 237));
}

.aeo-overview__finding-hint {
    font-size: 0.75rem;
    color: rgb(115 115 115);
    margin-top: 0.375rem;
    line-height: 1.4;
}
:is(.dark .aeo-overview__finding-hint) {
    color: rgb(163 163 163);
}

/* ─── Section 5: AI Search Preview ──────────────────────────────────────── */

/* Citation Likelihood gauge — horizontal bar + label */
.aeo-overview__cl-gauge {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    background-color: rgb(249 250 251);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
    margin-bottom: 0.875rem;
}
:is(.dark .aeo-overview__cl-gauge) {
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}

.aeo-overview__cl-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(115 115 115);
}
:is(.dark .aeo-overview__cl-label) {
    color: rgb(163 163 163);
}

.aeo-overview__cl-score {
    font-size: 1.125rem;
    font-weight: 800;
    color: rgb(23 23 23);
    font-variant-numeric: tabular-nums;
}
:is(.dark .aeo-overview__cl-score) {
    color: #ffffff;
}

.aeo-overview__cl-bar {
    height: 6px;
    background-color: rgb(229 231 235);
    border-radius: 3px;
    overflow: hidden;
}
:is(.dark .aeo-overview__cl-bar) {
    background-color: rgb(64 64 64);
}
.aeo-overview__cl-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background-color: rgb(115 115 115);
    transition: width 0.6s cubic-bezier(.22,1,.36,1);
}
.aeo-overview__cl-bar.aeo-band--great   > span { background-color: #22c55e; }
.aeo-overview__cl-bar.aeo-band--good    > span { background-color: #3b82f6; }
.aeo-overview__cl-bar.aeo-band--ok      > span { background-color: #f59e0b; }
.aeo-overview__cl-bar.aeo-band--bad     > span { background-color: #ef4444; }
.aeo-overview__cl-bar.aeo-band--pending > span { background-color: rgb(163 163 163); }

.aeo-overview__cl-band-label {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: rgb(243 244 246);
    color: rgb(82 82 82);
}
.aeo-overview__cl-band-label.aeo-band--great   { background-color: rgba(34,197,94,0.16);  color: #15803d; }
.aeo-overview__cl-band-label.aeo-band--good    { background-color: rgba(59,130,246,0.16); color: #1e40af; }
.aeo-overview__cl-band-label.aeo-band--ok      { background-color: rgba(245,158,11,0.16); color: #b45309; }
.aeo-overview__cl-band-label.aeo-band--bad     { background-color: rgba(239,68,68,0.16);  color: #b91c1c; }
.aeo-overview__cl-band-label.aeo-band--pending { background-color: rgb(243 244 246);      color: rgb(115 115 115); }
:is(.dark .aeo-overview__cl-band-label.aeo-band--great)   { color: #86efac; }
:is(.dark .aeo-overview__cl-band-label.aeo-band--good)    { color: #93c5fd; }
:is(.dark .aeo-overview__cl-band-label.aeo-band--ok)      { color: #fbbf24; }
:is(.dark .aeo-overview__cl-band-label.aeo-band--bad)     { color: #fca5a5; }
:is(.dark .aeo-overview__cl-band-label.aeo-band--pending) { color: rgb(163 163 163); }

/* Tab chrome */
.aeo-overview__ai-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid rgb(229 231 235);
    margin-top: 0.25rem;
}
:is(.dark .aeo-overview__ai-tabs) {
    border-bottom-color: rgb(64 64 64);
}

.aeo-overview__ai-tab {
    background: transparent;
    border: none;
    padding: 0.5rem 0.875rem;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(115 115 115);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.aeo-overview__ai-tab:hover {
    color: rgb(23 23 23);
}
:is(.dark .aeo-overview__ai-tab):hover {
    color: #ffffff;
}
.aeo-overview__ai-tab[aria-selected="true"] {
    color: rgb(23 23 23);
    border-bottom-color: var(--bg-primary, rgb(124 58 237));
}
:is(.dark .aeo-overview__ai-tab[aria-selected="true"]) {
    color: #ffffff;
}

.aeo-overview__ai-disclaimer {
    font-size: 0.6875rem;
    color: rgb(115 115 115);
    font-style: italic;
    margin: 0.5rem 0 0.75rem;
}
:is(.dark .aeo-overview__ai-disclaimer) {
    color: rgb(163 163 163);
}

.aeo-overview__ai-panel {
    padding: 0.875rem;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
    background-color: rgb(249 250 251);
}
:is(.dark .aeo-overview__ai-panel) {
    border-color: rgb(64 64 64);
    background-color: rgb(38 38 38);
}
.aeo-overview__ai-panel[hidden] { display: none; }

/* Google AIO chrome */
.aeo-aio__header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--bg-primary, rgb(124 58 237));
    font-weight: 700;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}
.aeo-aio__sparkle { font-size: 1rem; }
.aeo-aio__title { letter-spacing: 0.02em; }
.aeo-aio__answer {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgb(64 64 64);
    margin: 0;
}
:is(.dark .aeo-aio__answer) { color: rgb(212 212 212); }

.aeo-aio__facts {
    margin: 0.625rem 0 0;
    padding-left: 1.25rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgb(82 82 82);
}
:is(.dark .aeo-aio__facts) { color: rgb(192 192 192); }
.aeo-aio__facts li { margin-bottom: 0.25rem; }

.aeo-aio__sources {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.aeo-aio__source {
    display: inline-flex;
    flex-direction: column;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    background-color: #ffffff;
    border: 1px solid rgb(229 231 235);
    text-decoration: none;
    max-width: 18rem;
}
.aeo-aio__source:hover { border-color: var(--bg-primary, rgb(124 58 237)); }
:is(.dark .aeo-aio__source) {
    background-color: rgb(48 48 48);
    border-color: rgb(82 82 82);
}
.aeo-aio__source-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(23 23 23);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
:is(.dark .aeo-aio__source-title) { color: #ffffff; }
.aeo-aio__source-host {
    font-size: 0.6875rem;
    color: rgb(115 115 115);
}
:is(.dark .aeo-aio__source-host) { color: rgb(163 163 163); }

/* Perplexity chrome */
.aeo-plx__header h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: rgb(23 23 23);
}
:is(.dark .aeo-plx__header h4) { color: #ffffff; }

.aeo-plx__answer {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgb(64 64 64);
    margin: 0;
}
:is(.dark .aeo-plx__answer) { color: rgb(212 212 212); }

.aeo-plx__cite {
    color: var(--bg-primary, rgb(124 58 237));
    font-weight: 700;
    font-size: 0.6875rem;
    margin-left: 0.125rem;
}

.aeo-plx__sources {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    font-size: 0.8125rem;
    color: rgb(82 82 82);
}
:is(.dark .aeo-plx__sources) { color: rgb(192 192 192); }
.aeo-plx__sources li { margin-bottom: 0.25rem; }
.aeo-plx__sources a {
    color: rgb(23 23 23);
    text-decoration: none;
}
.aeo-plx__sources a:hover { text-decoration: underline; }
:is(.dark .aeo-plx__sources a) { color: #ffffff; }
.aeo-plx__source-title { font-weight: 600; }
.aeo-plx__source-host {
    color: rgb(115 115 115);
    font-size: 0.75rem;
    margin-left: 0.375rem;
}

/* ChatGPT chrome */
.aeo-gpt {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}
.aeo-gpt__user, .aeo-gpt__assistant {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.aeo-gpt__avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    background-color: rgb(115 115 115);
}
.aeo-gpt__avatar[data-role="assistant"] {
    background-color: var(--bg-primary, rgb(124 58 237));
}
.aeo-gpt__bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: #ffffff;
    border: 1px solid rgb(229 231 235);
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgb(64 64 64);
    flex: 1 1 auto;
    min-width: 0;
}
:is(.dark .aeo-gpt__bubble) {
    background-color: rgb(48 48 48);
    border-color: rgb(82 82 82);
    color: rgb(212 212 212);
}
.aeo-gpt__title {
    font-weight: 700;
    color: rgb(23 23 23);
    margin-bottom: 0.25rem;
}
:is(.dark .aeo-gpt__title) { color: #ffffff; }
.aeo-gpt__bubble p { margin: 0; }

/* Placeholder branches (pre-R22 missing extract OR Wix SPA empty) */
.aeo-overview__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: rgb(249 250 251);
    border: 1px dashed rgb(229 231 235);
    border-radius: 0.5rem;
    gap: 0.5rem;
}
:is(.dark .aeo-overview__placeholder) {
    background-color: rgb(38 38 38);
    border-color: rgb(64 64 64);
}
.aeo-overview__placeholder-icon {
    font-size: 2rem;
    color: rgb(115 115 115);
}
.aeo-overview__placeholder-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: rgb(23 23 23);
}
:is(.dark .aeo-overview__placeholder-title) { color: #ffffff; }
.aeo-overview__placeholder-body {
    font-size: 0.8125rem;
    color: rgb(82 82 82);
    line-height: 1.5;
    max-width: 36rem;
    margin: 0;
}
:is(.dark .aeo-overview__placeholder-body) { color: rgb(192 192 192); }
.aeo-overview__placeholder-cta { margin-top: 0.5rem; }

/* ─── Section 6: Score history sparkline ─────────────────────────────────── */

.aeo-overview__sparkline {
    width: 100%;
    height: 80px;
    display: block;
}
.aeo-overview__sparkline-area {
    fill: rgb(var(--bg-primary-rgb, 124 58 237) / 0.15);
    stroke: none;
}
.aeo-overview__sparkline-line {
    stroke: var(--bg-primary, rgb(124 58 237));
    stroke-width: 2;
    fill: none;
}
.aeo-overview__sparkline-dot {
    fill: var(--bg-primary, rgb(124 58 237));
    stroke: #ffffff;
    stroke-width: 1.5;
}
:is(.dark .aeo-overview__sparkline-dot) {
    stroke: rgb(38 38 38);
}

.aeo-overview__sparkline-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: rgb(115 115 115);
    font-variant-numeric: tabular-nums;
}
:is(.dark .aeo-overview__sparkline-meta) { color: rgb(163 163 163); }
.aeo-overview__sparkline-end--last {
    color: rgb(23 23 23);
    font-weight: 700;
}
:is(.dark .aeo-overview__sparkline-end--last) { color: #ffffff; }

/* ─── Bottom footer strip: Page metadata + CWV ─────────────────────────── */

.aeo-overview__footer-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    font-size: 0.8125rem;
}
.aeo-overview__footer-strip > div {
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgb(249 250 251);
}
:is(.dark .aeo-overview__footer-strip) > div {
    background-color: rgb(23 23 23);
}
.aeo-overview__footer-strip-label {
    font-size: 0.6875rem;
    color: rgb(115 115 115);
}
.aeo-overview__footer-strip-value {
    font-weight: 600;
    color: rgb(23 23 23);
}
:is(.dark .aeo-overview__footer-strip-value) { color: #ffffff; }

@media (max-width: 640px) {
    .aeo-overview__footer-strip { grid-template-columns: repeat(2, 1fr); }
}
