/* =========================
   최신 공통 테이블 스타일
   (투수 방식으로 통일)
   ========================= */

/* 필터바 */
.filter-row {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.filter-item.grow {
    flex: 1;
}

.filter-bar select, .filter-bar input {
    background: #121a33;
    color: #e2e8f0;
    border: 1px solid #2a3555;
    border-radius: 10px;
    padding: 8px 10px;
}

.search-button {
    background: transparent;
    border: 1px solid var(--team-color);
    color: var(--text);
}

.search-button:hover {
    box-shadow: 0 0 12px var(--team-color);
}

/* 뷰 네비 */
.view-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 8px 0 14px;
}

.nav-btn {
    background: #121a33;
    border: 1px solid #2a3555;
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: #1f2a47;
}

.dots .dot.active {
    background: var(--team-color);
    box-shadow: 0 0 10px var(--team-color);
}

/* 폭 변수(고정 2열) */
:root {
    --rank-col-w: 72px; /* 순위 열 너비 */
    --name-col-w: 180px; /* 선수명 열 너비 */
}

/* 컨테이너/테이블 */
.table-wrap {
    margin-top: 10px;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #1e2a44;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

#statsTable {
    border-collapse: collapse;
    width: 100%;
    min-width: 1100px;
}

#statsTable thead th {
    background: #0f1830;
    position: relative;
}

#statsTable th, #statsTable td {
    padding: 10px 12px;
    border-bottom: 1px solid #1b2440;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

#statsTable tbody tr:hover {
    background: #0f1833;
}

/* 고정 2열(투수 방식) */
#statsTable .fixed-col {
    position: sticky;
    left: 0;
    background: rgba(10, 14, 24, 0.9);
    backdrop-filter: blur(6px);
    z-index: 2;
}

/* 두 번째 고정열은 '첫 고정열의 바로 다음 형제'에 left 적용 */
#statsTable .fixed-col + .fixed-col {
    left: var(--rank-col-w);
    z-index: 2;
}

/* 폭 고정: 순위 / 선수명 */
#statsTable th.fixed-col:first-child,
#statsTable td.fixed-col.rank-cell {
    min-width: var(--rank-col-w);
    width: var(--rank-col-w);
}

#statsTable th.fixed-col + th.fixed-col,
#statsTable td.fixed-col + td.fixed-col {
    min-width: var(--name-col-w);
    width: var(--name-col-w);
}

/* 헤더 고정열 배경 살짝 구분 */
#statsTable thead th.fixed-col {
    background: #0f1830;
}

/* 헤더 인터랙션 */
.stat-header {
    user-select: none;
    position: relative;
}

.stat-header:hover {
    text-decoration: underline;
}

/* 툴팁 */
.th-tip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--team-color-2);
}

.th-tip .tip-box {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateY(-6px);
    background: #0b1220;
    color: #e2e8f0;
    border: 1px solid rgba(0, 240, 255, .3);
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 10px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
    z-index: 10;
}

.th-tip:hover .tip-box {
    visibility: visible;
    opacity: 1;
}

/* 레전드/날짜 */
.legend {
    margin: 12px 4px;
    color: #94a3b8;
    font-size: 13px;
}

.record-date {
    margin-top: 5px;
    font-size: .9rem;
    color: #aaa;
}

/* 뷰 점 표시 */
.dots .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #334155;
    margin: 0 4px;
    transition: transform .2s ease, background .2s ease;
}

.dots .dot.active {
    background: #00f0ff;
    transform: scale(1.2);
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .stats-body {
        font-size: 14px;
    }

    #statsTable th, #statsTable td {
        padding: 8px 10px;
    }

    #statsTable th.fixed-col:first-child,
    #statsTable td.fixed-col.rank-cell {
        min-width: 56px;
        width: 56px;
    }

    #statsTable th.fixed-col + th.fixed-col,
    #statsTable td.fixed-col + td.fixed-col {
        min-width: 150px;
        width: 150px;
    }
}

/* 순위 칼럼(텍스트) */
.rank-cell {
    text-align: center;
    padding: 4px 0;
}
