/* ==================================================
   JETBET V2
   TREND FINDER
================================================== */

:root {
    --bg: #080b11;
    --surface: #0d1119;
    --surface-2: #111620;
    --surface-3: #171d29;

    --border: #202632;
    --border-soft: #171d27;

    --purple: #805cff;
    --purple-hover: #9375ff;

    --green: #42d7a0;
    --green-soft: #5fe8b5;

    --gold: #f1b94d;

    --text: #f7f8fb;
    --text-soft: #c9ced9;
    --muted: #74809a;
    --muted-2: #515b70;

    --miss: #414957;

    --danger: #ff7885;
}


/* ==================================================
   BASE
================================================== */

* {
    box-sizing: border-box;
}


html {
    background: var(--bg);
}


body {
    margin: 0;

    min-height: 100vh;

    background:
        radial-gradient(
            circle at 45% -25%,
            rgba(94, 60, 170, 0.08),
            transparent 40rem
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


button,
select,
input {
    font: inherit;
}


/* ==================================================
   HEADER
================================================== */

.topbar {
    height: 64px;

    padding: 0 26px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border-soft);

    background: rgba(8, 11, 17, 0.98);
}


.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}



.brand-mark {
    width: 104px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    flex: 0 0 auto;

    border: 0;
    border-radius: 0;

    background: transparent;

    overflow: visible;

    text-decoration: none;

    transition:
        opacity 120ms ease,
        transform 120ms ease;
}


.brand-mark:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}


.brand-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: left center;

    background: transparent;
}


@media (max-width: 640px) {

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-image {
        content:
            url("/static/assets/brand/jetbet-logo.png?v=2");

        object-position: center;
    }
}


.league-logo-button {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    padding: 4px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;

    transition:
        background 120ms ease,
        border-color 120ms ease;
}


.league-logo-button:hover {
    border-color: var(--border);

    background: var(--surface-2);
}


.league-logo-button img {
    width: 24px;
    height: 24px;

    object-fit: contain;
}


.brand-copy {
    display: flex;
    align-items: baseline;
    gap: 14px;

    margin-left: 2px;
}


.brand-name {
    font-size: 13px;
    font-weight: 950;

    letter-spacing: 0.13em;
}


.page-name {
    color: var(--text-soft);

    font-size: 15px;
    font-weight: 800;
}


.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


.secondary-button,
.primary-button {
    height: 36px;

    padding: 0 17px;

    border-radius: 7px;

    font-size: 11px;
    font-weight: 800;

    cursor: pointer;
}


.secondary-button {
    border: 1px solid var(--border);

    background: transparent;

    color: var(--text-soft);
}


.secondary-button:hover {
    background: var(--surface-2);

    color: white;
}


.primary-button {
    border: 0;

    background: var(--purple);

    color: #080b10;
}


.primary-button:hover {
    background: var(--purple-hover);
}


.primary-button:disabled {
    opacity: 0.55;

    cursor: wait;
}


/* ==================================================
   QUERY SHELL
================================================== */

.query-shell {
    padding: 20px 26px 17px;

    border-bottom: 1px solid var(--border-soft);

    background: rgba(10, 13, 20, 0.9);
}


.query-builder {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;
}


.query-fragment {
    display: flex;
    align-items: center;

    gap: 8px;
}


.query-word {
    color: var(--muted);

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}


#active-date-label {
    height: 40px;

    padding: 0 13px;

    display: flex;
    align-items: center;

    border: 1px solid var(--purple);
    border-radius: 8px;

    background: rgba(128, 92, 255, 0.10);

    color: var(--text);

    font-size: 12px;
    font-weight: 850;
}


.query-control,
.context-control {
    height: 40px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 8px;

    outline: none;

    background: var(--surface-2);

    color: var(--text);

    font-size: 12px;
    font-weight: 750;
}


.query-control:hover,
.query-control:focus,
.context-control:hover,
.context-control:focus {
    border-color: #343c4d;
}


.position-control {
    min-width: 132px;
}


.team-control {
    width: 128px;
}


.player-control {
    width: 150px;
}


.stat-control {
    min-width: 188px;
}


.operator-control {
    width: 57px;

    padding-left: 11px;
}


.threshold-control {
    width: 72px;

    color: var(--gold);

    font-weight: 900;
}


.window-control {
    height: 40px;

    padding: 0 9px;

    display: flex;
    align-items: center;
    gap: 7px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface-2);

    color: var(--muted);

    font-size: 11px;
}


.window-control input {
    width: 29px;

    padding: 0;

    border: 0;
    outline: none;

    background: transparent;

    color: white;

    text-align: center;

    font-size: 12px;
    font-weight: 900;

    appearance: textfield;
}


.window-control input::-webkit-inner-spin-button,
.window-control input::-webkit-outer-spin-button {
    appearance: none;

    margin: 0;
}


/* ==================================================
   QUERY SUBROW
================================================== */

.query-subrow {
    margin-top: 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;
}


.preset-group {
    display: flex;
    align-items: center;
    gap: 4px;
}


.preset-button {
    height: 32px;

    min-width: 48px;

    padding: 0 11px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: var(--muted);

    font-size: 10px;
    font-weight: 800;

    cursor: pointer;
}


.preset-button:hover {
    color: var(--text);
}


.preset-button.active {
    background: var(--purple);

    color: #090b11;
}


.context-group {
    display: flex;
    align-items: center;
    gap: 8px;
}


.context-control {
    height: 32px;

    font-size: 10px;
}


.context-group select {
    width: 104px;
}


.context-group input {
    width: 136px;
}


.date-control:not(:placeholder-shown) {
    border-color: var(--border);
}


.text-button {
    height: 30px;

    padding: 0 8px;

    border: 0;

    background: transparent;

    color: var(--muted);

    font-size: 10px;

    cursor: pointer;
}


.text-button:hover {
    color: white;
}


/* ==================================================
   CONTENT
================================================== */

.content {
    padding: 0 26px 44px;
}


/* ==================================================
   RESULTS HEADER
================================================== */

.results-header {
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}


.results-meta,
.results-header-right {
    display: flex;
    align-items: center;
}


.results-meta {
    gap: 6px;

    font-size: 11px;
}


.results-meta strong {
    font-size: 13px;
}


.results-meta span {
    color: var(--muted);
}


.meta-dot {
    margin: 0 2px;
}


.results-header-right {
    gap: 18px;
}


.pool-summary {
    color: var(--muted);

    font-size: 10px;
}


.pool-summary strong {
    color: var(--green-soft);
}


.view-toggle {
    padding: 3px;

    display: flex;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface);
}


.view-button {
    height: 30px;

    padding: 0 13px;

    border: 0;
    border-radius: 6px;

    background: transparent;

    color: var(--muted);

    font-size: 10px;
    font-weight: 750;

    cursor: pointer;
}


.view-button.active {
    background: var(--surface-3);

    color: white;
}


/* ==================================================
   CARDS
================================================== */

.cards-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}


.player-card {
    min-width: 0;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: var(--surface);

    transition:
        transform 130ms ease,
        border-color 130ms ease;
}


.player-card:hover {
    transform: translateY(-2px);

    border-color: #30394a;
}


/* ==================================================
   TEAM HERO
================================================== */

.card-hero {
    min-height: 158px;

    padding: 18px 16px 15px;

    position: relative;

    display: flex;
    align-items: flex-end;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--team-primary) 70%,
                #151521
            ) 0%,
            color-mix(
                in srgb,
                var(--team-primary) 27%,
                #0e121a
            ) 57%,
            #0e121a 100%
        );
}


.card-hero::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            to bottom,
            rgba(7, 9, 14, 0.02),
            rgba(7, 9, 14, 0.22)
        );

    pointer-events: none;
}


.card-team-logo {
    position: absolute;

    width: 145px;
    height: 145px;

    right: 68px;
    top: 7px;

    object-fit: contain;

    opacity: 0.10;

    filter: grayscale(0.15);

    z-index: 0;
}


.card-headshot {
    position: absolute;

    right: 6px;
    bottom: 0;

    width: 132px;
    height: 148px;

    object-fit: contain;
    object-position: bottom;

    z-index: 1;

    filter:
        drop-shadow(
            -10px 3px 18px rgba(0, 0, 0, 0.24)
        );
}


.card-player-meta {
    position: relative;

    z-index: 3;

    max-width: calc(100% - 112px);
}


.card-team-position {
    margin-bottom: 4px;

    color: rgba(255, 255, 255, 0.76);

    font-size: 9px;
    font-weight: 850;

    letter-spacing: 0.10em;

    text-transform: uppercase;
}


.card-player-name {
    color: white;

    font-size: 18px;
    font-weight: 900;

    line-height: 1.05;

    letter-spacing: -0.025em;
}


/* ==================================================
   CARD BODY
================================================== */

.card-body {
    padding: 15px 14px 13px;
}


.card-main-stats {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 12px;
}


.hit-rate {
    color: var(--green);

    font-size: 27px;
    font-weight: 900;

    line-height: 1;
}


.hit-caption {
    margin-top: 5px;

    color: var(--muted);

    font-size: 8px;

    letter-spacing: 0.04em;
}


.average-block {
    text-align: right;
}


.average-value {
    color: white;

    font-size: 16px;
    font-weight: 850;
}


.average-label {
    margin-top: 4px;

    color: var(--muted);

    font-size: 7px;
    font-weight: 750;

    letter-spacing: 0.1em;

    text-transform: uppercase;
}


/* ==================================================
   CARD BARS
================================================== */

.performance-chart {
    height: 64px;

    margin-top: 15px;

    position: relative;

    display: grid;

    align-items: end;

    gap: var(--bar-gap, 3px);
}


.performance-bar {
    min-width: 1px;

    position: relative;

    z-index: 2;

    border-radius: 2px 2px 0 0;

    background: var(--miss);
}


.performance-bar.hit {
    background: var(--green);
}


.threshold-line {
    position: absolute;

    left: 0;
    right: 0;

    height: 1px;

    z-index: 1;

    background: rgba(241, 185, 77, 0.48);

    pointer-events: none;
}


/* ==================================================
   CARD FOOTER
================================================== */

.card-footer {
    margin-top: 12px;

    padding-top: 10px;

    display: flex;
    justify-content: flex-end;

    border-top: 1px solid var(--border-soft);

    color: var(--muted);

    font-size: 8px;
}


.card-last-game {
    width: 100%;

    text-align: right;
}


/* ==================================================
   TABLE
================================================== */

.table-shell {
    overflow-x: auto;
}


.table-shell table {
    width: 100%;

    border-collapse: separate;
    border-spacing: 0 7px;

    font-variant-numeric: tabular-nums;
}


.table-shell th {
    padding: 0 14px 3px;

    color: var(--muted);

    text-align: left;

    font-size: 8px;
    font-weight: 750;

    letter-spacing: 0.09em;

    text-transform: uppercase;
}


.table-shell td {
    height: 64px;

    padding: 7px 14px;

    background: var(--surface);

    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);

    color: var(--text-soft);

    font-size: 10px;
}


.table-shell td:first-child {
    border-left: 1px solid var(--border);
    border-radius: 11px 0 0 11px;
}


.table-shell td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 11px 11px 0;
}


.table-player {
    min-width: 210px;

    display: flex;
    align-items: center;
    gap: 10px;
}


.table-headshot-shell {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    position: relative;

    overflow: hidden;

    border: 1px solid var(--team-primary);
    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            color-mix(
                in srgb,
                var(--team-primary) 35%,
                #111720
            ),
            #0d1118
        );
}


.table-headshot {
    width: 100%;
    height: 100%;

    object-fit: contain;
}


.table-player-name {
    color: white;

    font-size: 11px;
    font-weight: 850;
}


.table-player-sub {
    margin-top: 3px;

    color: var(--muted);

    font-size: 8px;
}


.table-team {
    display: flex;
    align-items: center;
    gap: 7px;
}


.table-team img {
    width: 24px;
    height: 24px;

    object-fit: contain;
}


.mini-chart {
    width: 100%;
    min-width: 250px;
    height: 30px;

    display: grid;

    align-items: end;

    gap: var(--bar-gap, 2px);
}


.mini-bar {
    min-width: 1px;

    border-radius: 1px 1px 0 0;

    background: var(--miss);
}


.mini-bar.hit {
    background: var(--green);
}


.table-rate {
    color: var(--green);

    font-size: 13px;
    font-weight: 900;
}


.table-number {
    color: white;

    font-weight: 750;
}


/* ==================================================
   FALLBACK HEADSHOT
================================================== */

.initials-fallback {
    position: absolute;

    inset: 0;

    display: grid;
    place-items: center;

    color: rgba(255, 255, 255, 0.45);

    font-size: 10px;
    font-weight: 800;
}


/* ==================================================
   STATES
================================================== */

.loading-state,
.empty-state {
    grid-column: 1 / -1;

    min-height: 220px;

    display: grid;
    place-items: center;

    border: 1px dashed var(--border);
    border-radius: 12px;

    color: var(--muted);

    font-size: 11px;
}


.empty-table {
    height: 120px !important;

    text-align: center;
}


.error-box {
    margin-bottom: 15px;

    padding: 12px 14px;

    border: 1px solid rgba(255, 120, 133, 0.35);
    border-radius: 8px;

    background: rgba(255, 120, 133, 0.06);

    color: #ff9fa9;

    font-size: 10px;
}


.hidden {
    display: none !important;
}


/* ==================================================
   RESPONSIVE
================================================== */

@media (max-width: 1240px) {

    .cards-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


@media (max-width: 920px) {

    .cards-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 680px) {

    .topbar {
        padding: 0 14px;
    }


    .brand-name {
        display: none;
    }


    .page-name {
        font-size: 13px;
    }


    .query-shell,
    .content {
        padding-left: 14px;
        padding-right: 14px;
    }


    .query-builder {
        gap: 6px;
    }


    .query-word {
        display: none;
    }


    .query-control,
    .team-control,
    .player-control,
    .stat-control {
        flex: 1 1 140px;

        width: auto;
    }


    .query-subrow {
        align-items: flex-start;
        flex-direction: column;
    }


    .context-group {
        width: 100%;

        flex-wrap: wrap;
    }


    .cards-grid {
        grid-template-columns: 1fr;
    }


    .results-header {
        align-items: flex-start;
        flex-direction: column;

        padding: 13px 0;
    }


    .results-header-right {
        width: 100%;

        justify-content: space-between;
    }


    .card-hero {
        min-height: 178px;
    }


    .card-headshot {
        width: 150px;
        height: 168px;
    }

}