/* ============================================================
   team-analysis.css — Team Shot Analysis Page

   Top bar + team logo bar + court + stats panel
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- TOP BAR --- */
.top-bar {
    background-color: #16213e;
    padding: 14px 24px;
    border-bottom: 2px solid #e94560;
    text-align: center;
    position: relative;
}

.back-link {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #8892a8;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #e94560;
}

.app-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
}

.app-subtitle {
    font-size: 13px;
    color: #8892a8;
    margin-top: 2px;
}

/* --- TEAM SELECTOR BAR --- */
.team-bar {
    background-color: #16213e;
    border-bottom: 1px solid #2a2a4a;
    padding: 10px 16px;
    overflow-x: auto;
}

.team-bar-inner {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

.team-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border: 2px solid transparent;
    border-radius: 8px;
    background-color: #0f3460;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
    min-width: 52px;
}

.team-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.team-btn.selected {
    opacity: 1;
    border-color: var(--team-color, #e94560);
    box-shadow: 0 0 12px var(--team-color, #e94560);
    background-color: #16213e;
}

.team-btn.dimmed {
    opacity: 0.3;
}

.team-btn.dimmed:hover {
    opacity: 0.6;
}

.team-abbr {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.stats-team-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
}

/* --- COLLAPSE TOGGLE --- */
.collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: #8892a8;
    transition: color 0.2s;
}

.collapse-toggle:hover {
    color: #e94560;
}

.collapse-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.collapse-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.collapsible-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* --- GAME SELECTOR BAR --- */
.game-selector-bar {
    background-color: #121d36;
    border-bottom: 1px solid #2a2a4a;
    padding: 10px 24px;
}

.game-selector-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 10px;
}

.game-selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.selector-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #e94560;
    letter-spacing: 1px;
}

.season-select {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background-color: #0f3460;
    color: #ffffff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.season-select:focus {
    border-color: #e94560;
}

.game-select {
    width: 100%;
    max-width: 100%;
    height: 80px;
    padding: 4px;
    font-size: 12px;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background-color: #0f3460;
    color: #e0e0e0;
    outline: none;
    overflow-y: auto;
}

.game-select:focus {
    border-color: #e94560;
}

.game-select option {
    padding: 3px 6px;
}

.game-select option:checked {
    background-color: #e94560;
    color: #ffffff;
}

.game-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background-color: #0f3460;
    color: #c0c8d8;
    cursor: pointer;
    transition: all 0.2s;
}

.game-btn:hover {
    background-color: #e94560;
    color: #ffffff;
    border-color: #e94560;
}

.game-count-label {
    font-size: 12px;
    color: #8892a8;
}

/* --- HEX TOGGLE BUTTON --- */
.court-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}

.hex-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    background-color: #0f3460;
    color: #c0c8d8;
    cursor: pointer;
    transition: all 0.2s;
}

.hex-toggle-btn:hover {
    border-color: #e94560;
    color: #ffffff;
}

.hex-toggle-btn.active {
    background-color: #e94560;
    border-color: #e94560;
    color: #ffffff;
}

.hex-toggle-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4ecca3;
    transition: all 0.2s;
}

.hex-toggle-btn.active .hex-toggle-dot {
    border-radius: 2px;
    background-color: #ffffff;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    padding: 16px 20px;
}

/* --- EMPTY STATE --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #5a6a8a;
    font-size: 16px;
    text-align: center;
    gap: 12px;
}

.empty-icon {
    font-size: 48px;
    opacity: 0.4;
}

/* --- DASHBOARD (court + stats side by side) --- */
.dashboard {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- COURT SECTION --- */
.court-section {
    flex: 1;
    max-width: 700px;
}

#team-court {
    width: 100%;
}

#team-court .court-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- STATS COLUMNS --- */
.stats-columns {
    width: 480px;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-two-col {
    display: flex;
    gap: 10px;
}

.stats-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-col-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #e94560;
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a4a;
}

.stats-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    padding-bottom: 8px;
    border-bottom: 2px solid #e94560;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.stat-card {
    background-color: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 12px 14px;
}

.stat-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8892a8;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 4px 0 2px;
}

.stat-card-value.good { color: #4ecca3; }
.stat-card-value.avg { color: #f0c040; }
.stat-card-value.poor { color: #e94560; }

.stat-card-desc {
    font-size: 11px;
    color: #5a6a8a;
}

.record-card .stat-card-value {
    font-size: 22px;
}

/* --- TOOLTIP --- */
.tooltip {
    position: fixed;
    background-color: #16213e;
    border: 1px solid #e94560;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #e0e0e0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
    white-space: nowrap;
}

.tooltip.visible { opacity: 1; }
.tooltip .tip-label { font-weight: 600; color: #ffffff; }
.tooltip .tip-made { color: #4ecca3; }
.tooltip .tip-missed { color: #e94560; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
    }

    .stats-columns {
        width: 100%;
        min-width: unset;
    }

    .stats-two-col {
        flex-direction: row;
        gap: 8px;
    }

    .stat-card {
        flex: 1;
        min-width: 120px;
    }

    .stats-title {
        width: 100%;
    }

    .court-section {
        max-width: 100%;
    }

    .team-bar-inner {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 12px 16px;
    }

    .back-link {
        position: static;
        transform: none;
        display: block;
        margin-bottom: 6px;
        text-align: left;
    }

    .game-select {
        min-width: 100%;
    }
}
