/* =========================================
   2단 레이아웃 (PC: 65%/35%, 모바일: 1단)
   ========================================= */

.race-detail-container {
    display: grid;
    grid-template-columns: 1fr minmax(320px, 35%);
    gap: 2rem;
    align-items: start;
}

.sidebar-column {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* Firefox 스크롤바 다크 테마 */
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

/* 사이드바 내부 댓글 폼 입력칸 유연 배치 */
.sidebar-column .comment-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sidebar-column .comment-form-row > * {
    flex: 1 1 auto;
    min-width: 0;
}

/* 사이드바 스크롤바 다크 테마 */
.sidebar-column::-webkit-scrollbar {
    width: 6px;
}

.sidebar-column::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-column::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.sidebar-column::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* 모바일 1단 전환 */
@media (max-width: 992px) {
    .race-detail-container {
        grid-template-columns: 1fr;
    }

    /* 메인 컬럼 래퍼를 해체하여 자식을 그리드 직속으로 끌어올림 */
    .race-detail-container .main-column {
        display: contents;
    }

    /* 섹션 순서 강제 재배치: 레이스결과(1) → 응원&토론(2) → 팬라운지(3) */
    .race-detail-container .race-results-section {
        order: 1;
    }

    .race-detail-container .sidebar-column {
        order: 2;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .race-detail-container .content-divider {
        display: none;
    }

    .race-detail-container .fan-lounge-section {
        order: 3;
    }

    /* 모바일에서 섹션 간 간격 보완 (display: contents로 main-column 해체 시) */
    .race-detail-container .race-results-section,
    .race-detail-container .sidebar-column,
    .race-detail-container .fan-lounge-section {
        margin-bottom: 0.5rem;
    }
}

/* =========================================
   Top 3 포디움 카드
   ========================================= */

.podium-section {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    transition: opacity 0.15s ease;
}

.podium-card {
    position: relative;
    flex: 1;
    max-width: 220px;
    background: #1a1a1a;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    border-top: 4px solid #444;
    transition: transform 0.2s ease;
}

/* 포인트 뱃지 (Top-Right Pill) */
.podium-pts-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #e10600;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.3px;
    line-height: 1.2;
    white-space: nowrap;
}

.podium-card:hover {
    transform: translateY(-4px);
}

/* 1위: 금색 — 중앙 돌출 */
.podium-card[data-position="1"] {
    border-top-color: #FFD700;
    transform: translateY(-12px);
}

.podium-card[data-position="1"]:hover {
    transform: translateY(-16px);
}

/* 2위: 은색 */
.podium-card[data-position="2"] {
    border-top-color: #C0C0C0;
}

/* 3위: 동색 */
.podium-card[data-position="3"] {
    border-top-color: #CD7F32;
}

/* 순위 번호 */
.podium-position {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.podium-card[data-position="1"] .podium-position {
    color: #FFD700;
}

.podium-card[data-position="2"] .podium-position {
    color: #C0C0C0;
}

.podium-card[data-position="3"] .podium-position {
    color: #CD7F32;
}

/* 드라이버명 */
.podium-driver {
    font-size: 1rem;
    font-weight: 600;
    color: #f5f5f5;
    margin-bottom: 0.25rem;
}

/* 팀명 */
.podium-team {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

/* 기록 */
.podium-time {
    font-size: 0.85rem;
    font-family: 'Courier New', Courier, monospace;
    color: #aaa;
}

/* 포디움 모바일 반응형 */
@media (max-width: 768px) {
    .podium-section {
        gap: 0.5rem;
        padding: 0.5rem 0;
    }

    .podium-card {
        padding: 1rem 0.5rem;
        max-width: 160px;
    }

    .podium-position {
        font-size: 1.5rem;
    }

    .podium-driver {
        font-size: 0.85rem;
    }

    .podium-team {
        font-size: 0.7rem;
    }

    .podium-time {
        font-size: 0.75rem;
    }

    .podium-card[data-position="1"] {
        transform: translateY(-8px);
    }

    .podium-card[data-position="1"]:hover {
        transform: translateY(-12px);
    }

    .podium-pts-badge {
        top: 8px;
        right: 8px;
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
}

/* 포디움 초소형 모바일 반응형 (320px ~ 480px) */
@media (max-width: 480px) {
    .podium-section {
        gap: 0.35rem;
        padding: 0.25rem 0;
        max-width: 100%;
    }

    .podium-card {
        padding: 0.75rem 0.4rem;
        max-width: 110px;
        border-radius: 8px;
    }

    .podium-position {
        font-size: 1.2rem;
    }

    .podium-driver {
        font-size: 0.75rem;
    }

    .podium-team {
        font-size: 0.6rem;
    }

    .podium-time {
        font-size: 0.65rem;
    }

    .podium-card[data-position="1"] {
        transform: translateY(-6px);
    }

    .podium-card[data-position="1"]:hover {
        transform: translateY(-8px);
    }

    .podium-pts-badge {
        top: 6px;
        right: 4px;
        font-size: 0.55rem;
        padding: 0.1rem 0.3rem;
    }
}

/* =========================================
   레이스 결과 섹션 Layout Shift 방지 + 탭 전환 페이드
   ========================================= */

.race-results-section {
    min-height: 200px;
    overflow-x: hidden;
}

/* 결과 테이블 래퍼: 가로 스크롤 격리 (Local Scroll) */
.race-result-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* 탭 전환 중 결과 영역 페이드 — 로딩 스피너 없이 교체 중임을 암시 */
.race-results-section.results-fading .race-result-table,
.race-results-section.results-fading #podiumSection,
.race-results-section.results-fading .accordion-toggle-btn,
.race-results-section.results-fading .session-note {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

/* =========================================
   레이스 결과 테이블 (F1 다크 테마)
   ========================================= */

.race-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    white-space: nowrap;
}

.race-result-table thead {
    background: #1a1a1a;
}

.race-result-table thead th {
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #333;
    white-space: nowrap;
}

/* 컬럼 정렬 */
.race-result-table .col-pos,
.race-result-table .col-laps,
.race-result-table .col-pts {
    text-align: center;
}

.race-result-table .col-driver,
.race-result-table .col-constructor {
    text-align: left;
}

.race-result-table .col-time {
    text-align: right;
}

/* tbody 행 */
.race-result-table tbody tr {
    border-bottom: 1px solid #222;
    transition: background 0.15s;
}

.race-result-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.race-result-table tbody td {
    padding: 0.7rem 1rem;
    color: #ddd;
    vertical-align: middle;
}

/* 셀 정렬 (thead와 동기화) */
.race-result-table tbody .cell-pos,
.race-result-table tbody .cell-laps,
.race-result-table tbody .cell-pts {
    text-align: center;
}

.race-result-table tbody .cell-time {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
}

/* 순위 셀 */
.race-result-table tbody .cell-pos {
    font-weight: 700;
    font-size: 0.95rem;
}

/* 드라이버 이름 */
.race-result-table tbody .cell-driver {
    font-weight: 500;
    color: #f5f5f5;
}

/* 팀명 */
.race-result-table tbody .cell-constructor {
    color: #aaa;
}

/* 포인트 */
.race-result-table tbody .cell-pts {
    font-weight: 600;
}

/* ── 포디움 하이라이트 ── */

/* 1위: 금색 순위 + 좌측 보더 */
.race-result-table tbody tr.winner {
    background: rgba(255, 215, 0, 0.06);
    border-left: 3px solid #ffd700;
}

.race-result-table tbody tr.winner .cell-pos {
    color: #ffd700;
}

/* 2위: 은색 */
.race-result-table tbody tr.podium-2 .cell-pos {
    color: #c0c0c0;
}

/* 3위: 동색 */
.race-result-table tbody tr.podium-3 .cell-pos {
    color: #cd7f32;
}

/* ── hidden 유틸 ── */
.race-result-table.hidden {
    display: none;
}

/* 탭 전환 시 opacity 페이드 전환 */
.race-result-table {
    transition: opacity 0.15s ease;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
    .race-result-table {
        font-size: 0.8rem;
    }

    .race-result-table thead th,
    .race-result-table tbody td {
        padding: 0.5rem 0.5rem;
    }

    .race-result-table .col-constructor,
    .race-result-table tbody .cell-constructor {
        display: none;
    }
}

/* =========================================
   아코디언 테이블 (11위~ 토글)
   ========================================= */

/* 아코디언 tbody 기본 숨김 (클래스명: style.css의 트랙포인트 .accordion-content와 충돌 방지) */
tbody.race-result-accordion {
    display: none;
}

/* 아코디언 토글 버튼 */
.accordion-toggle-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.25rem;
    background: transparent;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    text-align: center;
}

.accordion-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f5f5f5;
    border-color: #666;
}

.accordion-toggle-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   세션 탭 네비게이션 (F1 다크 테마)
   ========================================= */

.session-tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.session-tab-nav::-webkit-scrollbar {
    display: none;
}

.session-tab-btn {
    flex-shrink: 0;
    padding: 0.5rem 1.2rem;
    background: transparent;
    color: #888;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.session-tab-btn:hover {
    color: #ddd;
    border-color: #555;
    background: rgba(255, 255, 255, 0.04);
}

.session-tab-btn.active {
    color: #f5f5f5;
    background: #e10600;
    border-color: #e10600;
    font-weight: 600;
}

/* ── 세션 탭 반응형 ── */

@media (max-width: 768px) {
    .session-tab-nav {
        gap: 0.35rem;
        margin-bottom: 1rem;
    }

    .session-tab-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.78rem;
    }
}

/* =========================================
   세션 안내 텍스트
   ========================================= */

.session-note {
    color: #aaa;
    font-size: 0.82rem;
    font-style: italic;
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}
