/* =========================================================================
   Fantasy Team Analyzer — polished dashboard styling on top of shared app CSS
   ========================================================================= */

.fta-dd .Select-menu-outer,
.fta-dd .Select-menu {
    z-index: 60;
}

/* ---- Status-line loading spinner: give it real box height so the rotating
   ring isn't squeezed into a thin streak by a near-zero-height flex row before
   any status text has rendered. ---- */
.fta-status-loading {
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* ---- Widget-scoped filter dropdowns (in card headers / pick popovers) ---- */
.fta-filter-dd .Select-control {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    min-height: 34px;
    font-size: 0.8rem;
}
.fta-filter-dd .Select-placeholder,
.fta-filter-dd .Select-value-label {
    line-height: 32px;
}



/* ---- pe-grid-style floating filters inside dashboard grids ---- */
#fta-dashboard .ag-theme-alpine-dark .ag-floating-filter-input .ag-input-field-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    font-size: 0.75rem;
}

/* ---- Pick-panel player search (header CTA -> floating name filter) ---- */
.fta-hsearch-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--accent-color, #6b8aff);
    border: 1px solid rgba(var(--accent-rgb), 0.45);
    background: rgba(var(--accent-rgb), 0.08);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.fta-hsearch-cta:hover {
    background: rgba(var(--accent-rgb), 0.16);
    border-color: rgba(var(--accent-rgb), 0.8);
    color: #e8eaed;
}

@media (max-width: 640px) {
    .fta-hsearch-cta {
        padding: 4px 9px;
        font-size: 0.68rem;
    }
}

.fta-hsearch-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: transparent;
    border: none;
    cursor: default;
}
.fta-hsearch-pop {
    position: absolute;
    top: 2px;
    right: 8px;
    z-index: 40;
    width: 230px;
    max-width: 92%;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    background: #1b1f27;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
    animation: fta-modal-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
.fta-pick-finput {
    width: 100%;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 5px 8px;
    height: 32px;
}
.fta-pick-finput:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.55);
}

/* ---- Vertically centre all dashboard grid cell content (name / pos / value /
   helps columns) so text isn't bottom-aligned; keep numeric cells right-aligned. */
#fta-dashboard .ag-theme-alpine-dark .ag-cell {
    display: flex;
    align-items: center;
}
#fta-dashboard .ag-theme-alpine-dark .ag-cell.ag-right-aligned-cell {
    justify-content: flex-end;
}

/* ---- Hero header ---- */
.fta-hero {
    background: rgba(22, 25, 31, 0.7);
}
.fta-hero-title {
    color: #e8eaed;
}

/* ---- KPI tiles ---- */
.fta-kpi {
    background: linear-gradient(150deg, rgba(var(--accent-rgb), 0.10) 0%, var(--card-bg) 55%);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.fta-kpi:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.fta-kpi-icon {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 1.15rem;
    color: rgba(var(--accent-rgb), 0.55);
}

/* ---- Card hover lift (dashboard sections) ---- */
#fta-dashboard .app-widget--glass {
    transition: border-color 0.16s ease;
}
#fta-dashboard .app-widget--glass:hover {
    border-color: rgba(var(--accent-rgb), 0.28);
}
#fta-trade-result .app-widget--glass {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* ---- Selection count pill ---- */
/* ---- Section labels between widget rows ---- */
.fta-section-label {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ---- Selection count pill ---- */
.fta-count-pill {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.14);
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    border-radius: 9999px;
    padding: 2px 10px;
    white-space: nowrap;
}

/* ---- Analysis Period date card ---- */
/* pt-date-card AND the pp-date-picker element itself carry elevated overlay
   z-indexes (10050+, so open calendars beat AG grids elsewhere); on this page
   that lifted the CLOSED date inputs above the player-profile modal's z-50
   backdrop. Neutralize both here and give the popover a local boost instead,
   so opening the calendar still overlays the grids but the closed inputs sit
   under the modal blur like everything else. */
.fta-date-card {
    z-index: auto !important;
}

.fta-date-card .pp-date-picker {
    z-index: auto !important;
}

.fta-date-card .DateRangePicker_picker {
    /* open calendar popover: above this page's cards/grids, below nothing that
       matters while it's open (the profile modal can't be open at the same
       time as the calendar) */
    z-index: 45 !important;
}

/* ---- Trade builder pick-lists (checkbox rosters) ---- */
.fta-pick-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 2px;
}
.fta-pick-list::-webkit-scrollbar { width: 8px; }
.fta-pick-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
}
.fta-checklist {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Column template shared by the header + every pick row (checkbox / name /
   pos / value). Sized to realistic content: a 20px checkbox, the player name
   takes ALL leftover space, position tokens ~"2B,SS,UT", a signed dollar
   value. Responsive: tighter fixed columns on small screens so the name never
   collapses to a few characters. (The template lives HERE, not in the
   component's inline labelStyle, so these media queries actually apply.) */
:root {
    --fta-pick-cols: 58px minmax(0, 1fr) minmax(58px, 84px) 52px;
    --fta-pick-gap: 10px;
}

@media (max-width: 640px) {
    :root {
        --fta-pick-cols: 38px minmax(0, 1fr) minmax(40px, 56px) 42px;
        --fta-pick-gap: 5px;
    }
    .fta-pick-head {
        padding: 4px 7px 7px;
        font-size: 0.58rem;
        letter-spacing: 0.03em;
    }
    .fta-pick-row {
        padding: 8px 7px;
        font-size: 0.8rem;
    }
    .fta-pick-pos { font-size: 0.68rem; }
    .fta-pick-val { font-size: 0.78rem; }
}

/* Narrow phones: shave the fixed columns further so the name never vanishes. */
@media (max-width: 390px) {
    :root {
        --fta-pick-cols: 30px minmax(0, 1fr) minmax(34px, 48px) 38px;
        --fta-pick-gap: 4px;
    }
}

.fta-pick-head,
.fta-pick-row {
    display: grid;
    grid-template-columns: var(--fta-pick-cols);
    align-items: center;
    column-gap: var(--fta-pick-gap);
}
.fta-pick-head {
    padding: 4px 11px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}
.fta-pick-head > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.fta-pick-head-add {
    text-align: center;
    white-space: normal;
    line-height: 1.15;
    overflow: hidden;
}
.fta-pick-head-val { text-align: right; }

.fta-pick-row {
    padding: 8px 11px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #cdd2da;
    border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.fta-pick-row:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
/* Label content spans participate directly in the row grid for perfect alignment */
.fta-pick-cells {
    display: contents;
}
.fta-pick-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.fta-pick-pos {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fta-pick-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--accent-color);
}

/* ---- Apple-style sleek checkbox ---- */
.fta-pick-row input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    justify-self: center;
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 7px;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.fta-pick-row input[type="checkbox"]:hover {
    border-color: rgba(var(--accent-rgb), 0.7);
}
.fta-pick-row input[type="checkbox"]:checked {
    background: linear-gradient(160deg, var(--accent-color), rgba(var(--accent-rgb), 0.82));
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.45);
}
.fta-pick-row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6.5px;
    top: 2.5px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(43deg);
}
.fta-pick-row input[type="checkbox"]:active {
    transform: scale(0.92);
}
.fta-pick-row input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.28);
}
/* Selected rows: accent wash + inset ring (matches .app-chip active state). */
.fta-pick-row:has(input:checked) {
    background: rgba(var(--accent-rgb), 0.15);
    border-color: rgba(var(--accent-rgb), 0.4);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.15);
}
.fta-pick-row:has(input:checked) .fta-pick-name { font-weight: 700; }
.fta-pick-row:has(input:checked) .fta-pick-pos { color: #cdd2da; }

/* ---- Roster-status section headers inside a pick list ---- */
.fta-pick-row:has(input:disabled) {
    cursor: default;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    padding-top: 12px;
    padding-bottom: 2px;
}
.fta-pick-row input:disabled {
    display: none;
}
.fta-pick-group {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding-bottom: 5px;
    border-bottom: 1px solid;
}
.fta-pick-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    flex: 0 0 auto;
}
.fta-pick-group-n {
    margin-left: auto;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    padding: 1px 8px;
    letter-spacing: 0;
}

/* ---- Widget-header starters/entire-team scope switch ---- */
.fta-scope {
    min-width: 160px;
}
@media (max-width: 640px) {
    .fta-scope {
        width: 100%;
    }
}

/* ---- Widget-header "Use Optimized Lineup" Apple-style toggle ---- */
.fta-opt-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.fta-opt-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
@media (max-width: 640px) {
    .fta-opt-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

/* ---- Roster-space note (add/drop evaluator) ---- */
.fta-space-note {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 34px;
}

/* ---- Season badge / past-season note ---- */.fta-season-badge,
.fta-past-season {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.8rem;
    border-radius: 10px;
    padding: 8px 12px;
}
.fta-season-badge {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.fta-season-badge .font-semibold { color: var(--text-primary); }
.fta-past-season {
    color: #f2c66b;
    background: rgba(242, 176, 74, 0.10);
    border: 1px solid rgba(242, 176, 74, 0.32);
}
.fta-past-season .font-semibold { color: #ffdfa0; }

/* ---- Balance wizard modal (custom overlay, app pattern) ---- */
#fta-wiz-modal .Select-menu-outer,
#fta-wiz-modal .Select-menu,
#fta-wiz-modal .Select__menu {
    z-index: 80;
}
#fta-wiz-modal > div:last-child {
    animation: fta-modal-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fta-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Text input accent focus ---- */
#fta-league-input:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

/* ---- Mobile refinements ---- */
@media (max-width: 640px) {
    #fta-dashboard .ag-theme-alpine-dark { font-size: 0.8rem; }
    .fta-hero-title { font-size: 1.6rem; }
    .fta-kpi .text-3xl { font-size: 1.6rem; }
    .fta-pick-list { max-height: 240px; }
}


