/* Competitieanalyse (krachtenkaart) — analyse.php
 * Bouwt op de huisstijlvariabelen (--app-*) uit site-instellingen.
 * Alleen de kleurschaal voor sterker/zwakker is eigen; die heeft een
 * donkere variant (prefers-color-scheme en [data-theme="dark"]). */

.analyse-page {
    --an-ink: var(--app-text, #163049);
    --an-ink-2: var(--app-text-soft, #3d5368);
    --an-ink-3: var(--app-muted, #607286);
    --an-line: var(--app-line, #d9e1e8);
    --an-line-2: var(--app-surface-soft, #eef3f8);
    --an-surface: var(--app-surface, #ffffff);
    --an-accent: var(--app-accent, #0f4c81);
    --an-d-3: #b5431c;
    --an-d-2: #e07b52;
    --an-d-1: #f3c3aa;
    --an-d0: #e9edf0;
    --an-d1: #b3cde6;
    --an-d2: #5d93cc;
    --an-d3: #1d5aa6;
    --an-on-dark: #ffffff;
    --an-pos: #2e6fb8;
    --an-neg: #c95a33;
    --an-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .analyse-page {
        --app-bg: #0d1820;
        --app-surface: #13222c;
        --app-surface-soft: #1c2e3b;
        --app-text: #e8eff4;
        --app-text-soft: #c3d0da;
        --app-muted: #9aabb8;
        --app-line: #26394a;
        --app-line-strong: #36506a;
        --app-accent: #4cb3d4;
        --app-accent-soft: #16303f;
        --an-d-3: #c9532a;
        --an-d-2: #97462a;
        --an-d-1: #5b3426;
        --an-d0: #26333d;
        --an-d1: #22456a;
        --an-d2: #2f68a6;
        --an-d3: #4a8ad6;
        --an-pos: #5c9be0;
        --an-neg: #e07a52;
        color-scheme: dark;
        background: var(--app-bg);
        color: var(--app-text);
    }
}

:root[data-theme="dark"] .analyse-page {
    --app-bg: #0d1820;
    --app-surface: #13222c;
    --app-surface-soft: #1c2e3b;
    --app-text: #e8eff4;
    --app-text-soft: #c3d0da;
    --app-muted: #9aabb8;
    --app-line: #26394a;
    --app-line-strong: #36506a;
    --app-accent: #4cb3d4;
    --app-accent-soft: #16303f;
    --an-d-3: #c9532a;
    --an-d-2: #97462a;
    --an-d-1: #5b3426;
    --an-d0: #26333d;
    --an-d1: #22456a;
    --an-d2: #2f68a6;
    --an-d3: #4a8ad6;
    --an-pos: #5c9be0;
    --an-neg: #e07a52;
    color-scheme: dark;
    background: var(--app-bg);
    color: var(--app-text);
}

.analyse-page .analyse {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.analyse-card {
    background: var(--an-surface);
    border: 1px solid var(--an-line);
    border-radius: var(--app-radius, 10px);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.analyse-card h2,
.analyse-card h3 {
    margin: 0;
    color: var(--an-ink);
}

.analyse-card p {
    margin: 0;
    max-width: 72ch;
    color: var(--an-ink-2);
}

.analyse-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.analyse-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.analyse-filters label,
.analyse-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .82rem;
    color: var(--an-ink-3);
    min-width: 0;
}

.analyse-page select,
.analyse-page .analyse-input {
    font: inherit;
    font-size: .95rem;
    color: var(--an-ink);
    background: var(--an-surface);
    border: 1px solid var(--an-line);
    border-radius: 8px;
    padding: 7px 10px;
    max-width: 100%;
}

.analyse-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    font-size: .9rem;
    color: var(--an-ink-2);
}

.analyse-facts b {
    font-family: var(--an-mono);
    font-weight: 500;
    color: var(--an-ink);
}

.analyse-notice {
    font-size: .88rem;
    color: var(--an-ink-2);
    background: var(--an-line-2);
    border-radius: 8px;
    padding: 8px 12px;
}

/* Schakelaar */
.analyse-seg {
    display: inline-flex;
    border: 1px solid var(--an-line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--an-surface);
}

.analyse-seg button {
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    border: 0;
    background: transparent;
    color: var(--an-ink-2);
    padding: 7px 14px;
    cursor: pointer;
}

.analyse-seg button[aria-pressed="true"] {
    background: var(--an-accent);
    color: var(--an-on-dark);
}

.analyse-page button:focus-visible,
.analyse-page select:focus-visible,
.analyse-page [tabindex]:focus-visible {
    outline: 2px solid var(--an-accent);
    outline-offset: 2px;
}

/* Matrix: scrolt horizontaal binnen de eigen container */
.analyse-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table.analyse-mx {
    border-collapse: separate;
    border-spacing: 2px;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

.analyse-mx th {
    font-size: .76rem;
    font-weight: 600;
    color: var(--an-ink-2);
    text-align: center;
    padding: 6px 4px;
    vertical-align: bottom;
    line-height: 1.2;
}

.analyse-mx th.club {
    text-align: left;
}

.analyse-mx th.grp {
    border-left: 2px solid var(--an-line);
}

.analyse-mx td.club,
.analyse-mx th.club {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--an-surface);
}

.analyse-mx td.club {
    font-weight: 600;
    white-space: nowrap;
    padding: 0 10px 0 4px;
    font-size: .9rem;
    color: var(--an-ink);
    text-align: left;
}

@media (max-width: 520px) {
    .analyse-mx td.club {
        max-width: 132px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .analyse-mx td.club button {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.analyse-mx td.club button,
.analyse-potrow button {
    display: block;
    width: auto;
    min-height: 0;
    box-shadow: none;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analyse-mx td.club button:hover,
.analyse-mx tr.is-selected td.club button {
    color: var(--an-accent);
}

.analyse-mx tr.is-selected td.club button::before {
    content: "▸ ";
}

.analyse-mx td.tot {
    font-family: var(--an-mono);
    font-size: .82rem;
    text-align: right;
    padding-right: 10px;
    color: var(--an-ink-2);
}

.analyse-mx td.c {
    min-width: 48px;
    height: 32px;
    text-align: center;
    font-family: var(--an-mono);
    font-size: .82rem;
    border-radius: 3px;
    color: var(--an-ink);
}

.analyse-mx td.c small {
    display: block;
    font-size: .64rem;
    line-height: 1;
    opacity: .8;
}

.an-s-3 { background: var(--an-d-3); color: var(--an-on-dark) !important; }
.an-s-2 { background: var(--an-d-2); }
.an-s-1 { background: var(--an-d-1); }
.an-s0 { background: var(--an-d0); }
.an-s1 { background: var(--an-d1); }
.an-s2 { background: var(--an-d2); color: var(--an-on-dark) !important; }
.an-s3 { background: var(--an-d3); color: var(--an-on-dark) !important; }

.analyse-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    font-size: .8rem;
    color: var(--an-ink-2);
    border-top: 1px solid var(--an-line);
    padding-top: 10px;
}

.analyse-legend .sw {
    display: inline-flex;
    gap: 2px;
}

.analyse-legend .sw i {
    width: 24px;
    height: 12px;
    display: block;
    border-radius: 2px;
}

/* Clubprofiel */
.analyse-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
}

.analyse-kpi {
    display: flex;
    flex-direction: column;
}

.analyse-kpi span {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--an-ink-3);
}

.analyse-kpi b {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--an-ink);
}

.analyse-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 860px) {
    .analyse-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.analyse-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.analyse-note {
    font-size: .82rem;
    color: var(--an-ink-3) !important;
}

.analyse-evgroup h4 {
    margin: 10px 0 4px;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--an-ink-3);
}

.analyse-evrow {
    display: grid;
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 46px;
    align-items: center;
    gap: 10px;
    padding: 3px 4px;
    border-radius: 4px;
}

.analyse-evrow:hover,
.analyse-evrow:focus {
    background: var(--an-line-2);
}

.analyse-evname {
    font-size: .86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--an-ink);
}

.analyse-evname small {
    color: var(--an-ink-3);
    font-size: .76rem;
    margin-right: 4px;
}

.analyse-bar {
    position: relative;
    height: 16px;
}

.analyse-bar .axis {
    position: absolute;
    left: 50%;
    top: -3px;
    bottom: -3px;
    width: 1px;
    background: var(--an-ink-3);
}

.analyse-bar .fill {
    position: absolute;
    top: 2px;
    height: 12px;
    border-radius: 2px;
}

.analyse-evrank {
    font-family: var(--an-mono);
    font-size: .78rem;
    text-align: right;
    color: var(--an-ink-2);
}

.analyse-tag {
    font-size: .68rem;
    font-weight: 700;
    color: var(--an-neg);
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.analyse-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.analyse-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--an-line-2);
    font-size: .9rem;
    color: var(--an-ink);
}

.analyse-list li:last-child {
    border-bottom: 0;
}

.analyse-list .v {
    font-family: var(--an-mono);
    font-size: .82rem;
    white-space: nowrap;
}

.analyse-crow {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 60px;
    gap: 10px;
    align-items: center;
    font-size: .86rem;
    color: var(--an-ink);
}

.analyse-ctrack {
    position: relative;
    height: 14px;
    background: var(--an-line-2);
    border-radius: 2px;
}

.analyse-ctrack .cf {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--an-accent);
    border-radius: 2px;
}

.analyse-ctrack .cm {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: var(--an-ink);
}

.analyse-cval {
    font-family: var(--an-mono);
    font-size: .78rem;
    text-align: right;
}

/* Potentieel */
.analyse-potrow {
    display: grid;
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 60px;
    gap: 10px;
    align-items: center;
    font-size: .88rem;
    padding: 2px 0;
    color: var(--an-ink);
}

.analyse-potrow button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analyse-potrow.is-selected button {
    color: var(--an-accent);
    font-weight: 700;
}

.analyse-ptrack {
    height: 14px;
    position: relative;
}

.analyse-ptrack i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 0 2px 2px 0;
    background: var(--an-neg);
}

/* Vergelijking */
.analyse-compare table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.analyse-compare th,
.analyse-compare td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--an-line-2);
    color: var(--an-ink);
}

.analyse-compare td.num {
    font-family: var(--an-mono);
    text-align: right;
}

/* Tooltip */
.analyse-tip {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    background: var(--an-ink);
    color: var(--an-surface);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: .8rem;
    line-height: 1.4;
    max-width: 300px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.analyse-tip b {
    font-weight: 700;
}

@media (max-width: 520px) {
    .analyse-card {
        padding: 14px;
    }

    .analyse-evrow {
        grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 38px;
        gap: 6px;
    }

    .analyse-potrow {
        grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 52px;
    }

    .analyse-crow {
        grid-template-columns: 78px minmax(0, 1fr) 52px;
    }

    .analyse-filters label {
        flex: 1 1 140px;
    }

    .analyse-page select {
        width: 100%;
    }
}
