/* Charts & analytics scatter plots */

.stats-charts-page {
    max-width: 1240px;
}

.stats-charts-toolbar {
    margin-bottom: 1.25rem;
}

.stats-charts-toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.stats-charts-toolbar-controls > .mb-3 {
    margin-bottom: 0 !important;
}

.stats-charts-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

#chartScatterControls,
#beatBadControls,
#explorerControls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

#chartScatterControls[hidden],
#beatBadControls[hidden],
#explorerControls[hidden] {
    display: none !important;
}

.stats-charts-controls .form-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.stats-charts-controls .form-select,
.stats-charts-controls .form-control {
    min-width: 150px;
    font-size: 0.88rem;
}

.stats-charts-note {
    font-size: 0.82rem;
    color: #6c757d;
    margin-bottom: 1.25rem;
}

.stats-charts-section {
    margin-bottom: 2.5rem;
}

.stats-charts-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.stats-charts-section-lead {
    font-size: 0.88rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.stats-charts-view-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stats-charts-view-btn {
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    cursor: pointer;
}

.stats-charts-view-btn:hover {
    border-color: #1e3a5f;
    color: #1e3a5f;
}

.stats-charts-view-btn.is-active {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
}

.stats-chart-card--single {
    margin-bottom: 0;
    overflow: visible;
}

.stats-chart-beat-bad-bg {
    fill: #faf6ef;
}

.stats-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.stats-chart-header-text {
    min-width: 0;
}

.stats-chart-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    padding: 0.25rem 0.45rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #eef1f4;
}

.stats-chart-brand img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
}

.stats-chart-brand span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1e3a5f;
    white-space: nowrap;
}

.stats-chart-brand--plot {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 12;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 0.15rem 0.3rem;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 5px;
}

.stats-chart-brand--header {
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
}

.stats-chart-brand--header img {
    display: block;
    height: 28px;
    width: auto;
    max-width: 118px;
    object-fit: contain;
}

.stats-chart-header--beat-bad {
    align-items: center;
    margin-bottom: 0.5rem;
}

.stats-chart-brand--plot img {
    display: block;
    height: 28px;
    width: auto;
    max-width: 118px;
    object-fit: contain;
}

.stats-chart-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1rem 1rem 1.15rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stats-chart-host {
    width: 100%;
    overflow: visible;
}

.stats-chart-host--success-index {
    overflow: visible;
    padding-bottom: 0.75rem;
}

.stats-chart-blurb {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #eef1f4;
    font-size: 0.88rem;
    color: #495057;
    line-height: 1.55;
}

.stats-chart-blurb p {
    margin: 0;
}

.stats-chart {
    position: relative;
    margin: 0 auto;
}

.stats-chart-header {
    margin-bottom: 0.35rem;
}

.stats-chart-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a2332;
}

.stats-chart-subtitle {
    font-size: 0.82rem;
    color: #6c757d;
}

.stats-chart-body {
    position: relative;
}

.stats-chart-plot-wrap {
    position: relative;
    margin: 0 auto;
}

.stats-chart-svg {
    display: block;
    width: 100%;
    height: auto;
}

.stats-chart-grid line {
    stroke: #eceff3;
    stroke-width: 1;
}

.stats-chart-quadrants line {
    stroke: #adb5bd;
    stroke-width: 1.25;
    stroke-dasharray: 5 4;
}

.stats-chart-trend {
    stroke: #868e96;
    stroke-width: 1.5;
}

.stats-chart-axis text {
    fill: #6c757d;
    font-size: 11px;
    font-family: inherit;
}

.stats-chart-axis-title text {
    fill: #495057;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: inherit;
}

.stats-chart-border {
    stroke: #dee2e6;
    stroke-width: 1;
}

.stats-chart-logos {
    position: absolute;
    pointer-events: none;
}

.stats-chart-logo-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    opacity: 0.82;
    transition: opacity 0.12s ease, transform 0.12s ease, z-index 0s;
    z-index: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.stats-chart-logo-marker img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.stats-chart-logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.4rem;
    font-weight: 700;
    color: #fff;
    background: #6c757d;
}

.stats-chart-logo-marker.is-hover,
.stats-chart-logo-marker.is-highlighted,
.stats-chart-logo-marker:focus-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 20;
    outline: none;
}

.stats-chart-logo-marker.is-highlighted {
    box-shadow: 0 0 0 2px #1e3a5f, 0 0 0 4px rgba(30, 58, 95, 0.18);
}

.stats-chart-tooltip {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 30;
    min-width: 160px;
    max-width: 220px;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(26, 35, 50, 0.94);
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.45;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.stats-chart-tooltip strong {
    display: block;
    font-size: 0.84rem;
    margin-bottom: 0.2rem;
}

.stats-chart-tooltip span {
    display: block;
}

.stats-chart-regression {
    text-align: right;
    font-size: 0.76rem;
    color: #6c757d;
    margin-top: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.stats-chart-empty,
.stats-charts-error {
    padding: 1.25rem;
    border-radius: 10px;
    background: #f8f9fa;
    color: #6c757d;
    text-align: center;
}

.stats-charts-error {
    background: #fff5f5;
    color: #b42318;
    border: 1px solid #fecdca;
}

.stats-charts-explorer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.stats-charts-explorer-controls[hidden] {
    display: none !important;
}

.stats-chart--beat-bad .stats-chart-title {
    font-size: 1.35rem;
    font-weight: 800;
}

.stats-chart--beat-bad .stats-chart-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a2332;
}

.stats-chart-sort-label {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #1e3a5f;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stats-chart-beat-bad-scroll {
    overflow: visible;
    width: 100%;
    padding-bottom: 0.75rem;
}

.stats-chart--beat-bad {
    width: 100%;
    max-width: 100%;
}

.stats-chart-plot-wrap--beat-bad {
    position: relative;
    overflow: visible;
    max-width: 100%;
    background: #faf6ef;
    border-radius: 4px;
}

.stats-chart-svg--beat-bad {
    display: block;
    overflow: visible;
}

.stats-chart-axis-title--beat-bad {
    fill: #1a2332;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
}

.stats-chart-zero-line {
    stroke: #1a2332;
    stroke-width: 1.5;
}

.stats-chart-axis--beat-bad text {
    fill: #1a2332;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
}

.stats-chart-beat-bad-xlabel {
    fill: #1a2332;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
}

.stats-chart-beat-bad-logos {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}

.stats-chart-beat-bad-logo {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    font-size: 0.55rem;
    font-weight: 700;
    color: #495057;
}

.stats-chart-beat-bad-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stats-chart-bar-hit {
    cursor: pointer;
}

.stats-chart-tooltip--beat-bad {
    position: absolute;
    right: auto;
    z-index: 30;
    min-width: 190px;
    max-width: 260px;
    pointer-events: none;
    transform: translateY(-100%);
}

@media (max-width: 767.98px) {
    .stats-chart-logo-marker {
        width: 14px;
        height: 14px;
    }

    .stats-charts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-chart-brand--plot img {
        height: 24px;
        max-width: 100px;
    }
}
