﻿/* ====================================================
   🌐 1. 전역 스타일 및 기본 리셋 (Global Defaults)
   ==================================================== */
* {
    box-sizing: border-box; /* 패딩과 테두리를 가로폭에 포함시켜 레이아웃 터짐 방지 */
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* 브라우저 자체의 거슬리는 전역 가로 스크롤바 원천 차단 */
    background-color: #0f172a; /* 전체 배경색 (어두운 네이비 다크모드) */
    color: #f8fafc; /* 기본 글자색 (밝은 회색 계열) */
    /* 🎯 [스프라켓 화살표 해결] 브라우저에게 다크모드 시스템임을 선언하여 
       어두운 배경에 묻혀서 안 보이던 셀렉트 박스 화살표를 흰색으로 자동 반전시킵니다. */
    color-scheme: dark;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* 브라우저 뷰포트 100% 보장 */
}

/* ====================================================
   🌐 2. 상단 네비게이션 바 (Top Navigation Bar)
   ==================================================== */
.navbar {
    background-color: #1e293b;
    padding: 10px 20px;
    position: sticky; /* 스크롤을 내려도 상단에 고정 */
    top: 0;
    z-index: 9999;
}

.navbar-container {
    max-width: 1550px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 50px;
}

.navbar-logo {
    color: #38bdf8;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-menu {
    display: flex;
    list-style: none;
    flex-shrink: 0; /* 화면이 좁아져도 메뉴 글자들이 찌그러지지 않게 방어 */
    gap: 12px !important;
}

.tab-item {
    color: #94a3b8;
    cursor: pointer;
    font-weight: 600;
    padding: 5px 10px;
    text-decoration: none;
    white-space: nowrap; /* 글자가 밑으로 깨져서 줄바꿈되는 현상 차단 */
    font-size: 13.5px !important;
}

.tab-menu a.active {
    color: #38bdf8;
    border-bottom: 2px solid #38bdf8;
}

/* ====================================================
   📁 3. 메인 레이아웃 허브 (Main Wrapper & Grid)
   ==================================================== */
.main-content {
    width: 100%;
    margin: 20px auto;
    padding: 0 20px;
    box-sizing: border-box;
    flex: 1;
}

/* 왼쪽 메뉴바와 오른쪽 계산기 본문을 정렬하는 최외곽 허브 */
.calc-layout-hub {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    gap: 20px;
    align-items: flex-start;
}

/* 좌측 인풋 패널과 우측 테이블 보드를 가로 정렬하는 핵심 랩퍼 */
.calc-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    box-sizing: border-box;
    flex: 1; /* 사이드바를 제외한 남은 여백을 유연하게 채움 */
    min-width: 0; /* 자식이 아무리 커도 본인 가로폭을 터트리지 못하게 제어 */
    width: 100%;
}

.calc-left {
    flex: 1;
    min-width: 300px;
    max-width: 380px; /* 입력창들이 과하게 뚱뚱해지는 것을 차단 */
    width: 100%;
    box-sizing: border-box;
}

.calc-right {
    flex: 3;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* 테이블이 부모 경계선을 뚫고 탈출하는 행위 차단 */
    box-sizing: border-box;
}

/* ====================================================
   🗂️ 4. 계산기 전용 세로형 사이드 메뉴 탭 (Sidebar Tabs)
   ==================================================== */
.calc-mode-tabs {
    display: flex;
    flex-direction: column; /* 탭 버튼들을 위아래 세로 방향으로 누적 */
    gap: 10px;
    margin: 0;
    width: 200px; /* 세로 메뉴 바 고정 가로폭 */
    flex-shrink: 0; /* 화면이 좁아져도 메뉴바가 절대 짜부라지지 않게 방어 */
}

.calc-mode-tab {
    width: 100%;
    padding: 12px 14px;
    text-align: center;
    background: #0f172a;
    color: #64748b;
    border: 1px solid #334155;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s ease;
    white-space: nowrap; /* 메뉴 글자가 길어도 절대 쪼개지지 않게 유지 */
}

    .calc-mode-tab.active {
        background: #38bdf8;
        color: #0f172a;
        border-color: #38bdf8;
        box-shadow: -4px 4px 12px rgba(56, 189, 248, 0.25);
        /*transform: translateX(3px);*/
    }

/* ====================================================
   📥 5. 공통 인풋 폼 & 결과 창 (Input Groups & Reports)
   ==================================================== */
.input-group {
    margin-bottom: 16px;
}

    .input-group label {
        display: block;
        margin-bottom: 6px;
        color: #94a3b8;
        font-size: 14px;
    }

    .input-group input,
    .input-group select {
        width: 100%;
        padding: 10px;
        background: #1e293b;
        border: 1px solid #334155;
        border-radius: 6px;
        color: #fff;
        outline: none;
    }

.result-box {
    margin-top: 25px;
    padding: 20px;
    background: #1e293b;
    border-radius: 8px;
    border: 1px solid #38bdf8;
}

.speed-text {
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    color: #38bdf8;
    margin: 15px 0;
}

/* ====================================================
   📊 6. 대형 인터랙티브 기어비 차트 (Gear Matrix Dashboard)
   ==================================================== */
.gear-chart-container {
    border: 1px solid #334155;
    border-radius: 10px;
    background: #1e293b;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* 🎯 중복 걷어내고 스크롤 기능 단일화 고정 완료 */
    -webkit-overflow-scrolling: touch;
}

    /* 기어 차트 스크롤바 디자인 */
    .gear-chart-container::-webkit-scrollbar {
        height: 6px;
    }

    .gear-chart-container::-webkit-scrollbar-track {
        background: #0f172a;
    }

    .gear-chart-container::-webkit-scrollbar-thumb {
        background: #334155;
        border-radius: 3px;
    }

        .gear-chart-container::-webkit-scrollbar-thumb:hover {
            background: #38bdf8;
        }

.gear-matrix-table {
    width: 100%;
    border-collapse: separate; /* sticky 열 테두리 깨짐 방지 */
    border-spacing: 0;
    text-align: center;
    color: #cbd5e1;
    table-layout: fixed;
    font-size: 14px;
    min-width: 900px; /* 그래블 사양 추가 대비 테이블 본연의 최소 가로폭 확보 */
}

    .gear-matrix-table th {
        background: #0f172a;
        color: #cbd5e1;
        font-weight: bold;
        white-space: nowrap;
        padding: 12px 2px;
    }

        /* 🎯 [좌측 행 첫 번째 열 고정] 스크롤 시 앞 크랭크 체인링 목록 고정 */
        .gear-matrix-table th:first-child,
        .gear-matrix-table td.front-header-cell {
            position: sticky;
            left: 0;
            z-index: 10;
            background: #0f172a !important;
            border-right: 2px solid #334155 !important;
        }

    .gear-matrix-table td.front-header-cell {
        color: #38bdf8;
        font-weight: bold;
        font-size: 13px;
    }

    .gear-matrix-table td.gear-data-cell {
        padding: 12px 0;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .gear-matrix-table th.active-cassette-col {
        color: #5cf42e !important;
        background: rgba(92, 244, 46, 0.15) !important;
        border-bottom: 2px solid #5cf42e;
    }

    .gear-matrix-table td.active-cassette-cell {
        background: rgba(56, 189, 248, 0.09);
        border-left: 1px dashed rgba(56, 189, 248, 0.15);
        border-right: 1px dashed rgba(56, 189, 248, 0.15);
    }

        .gear-matrix-table td.active-cassette-cell span {
            color: #ffffff;
            font-weight: 600;
        }

    .gear-matrix-table td.inactive-cassette-cell {
        opacity: 0.35;
        font-size: 12px;
    }

    .gear-matrix-table tr.highlighted-row {
        background: rgba(56, 189, 248, 0.03);
    }

    .gear-matrix-table td.col-cross {
        background: rgba(56, 189, 248, 0.05) !important;
    }

    .gear-matrix-table td.current-selected-gear {
        background: #38bdf8 !important;
        color: #0f172a !important;
        font-weight: bold !important;
        opacity: 1 !important;
        box-shadow: inset 0 0 4px #fff;
    }

        .gear-matrix-table td.current-selected-gear span {
            color: #0f172a !important;
        }

/* ====================================================
   📝 7. 자유게시판 및 🚴‍♂️ 8. 코스 분석기 시스템 레이아웃
   ==================================================== */
.board-layout-hub {
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

.board-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.write-section {
    background: #0f172a;
    padding: 20px;
    border-radius: 8px;
}

    .write-section input, .write-section textarea {
        width: 100%;
        padding: 10px;
        margin-bottom: 12px;
        background: #1e293b;
        border: 1px solid #334155;
        border-radius: 6px;
        color: #fff;
        outline: none;
    }

    .write-section textarea {
        height: 160px;
        resize: none;
    }

.board-header-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.board-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

    .board-table th, .board-table td {
        padding: 12px;
        border-bottom: 1px solid #334155;
    }

    .board-table th {
        background-color: #0f172a;
        color: #38bdf8;
        font-weight: bold;
    }

    .board-table tr:hover td {
        background-color: #1e293b;
        cursor: pointer;
    }

    .board-table .title-cell {
        text-align: left;
        max-width: 400px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

.page-btn {
    padding: 6px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

    .page-btn.active {
        background: #38bdf8;
        color: #0f172a;
        border-color: #38bdf8;
    }

    .page-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.board-view-sub {
    background: #0f172a;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #334155;
}

    .board-view-sub h3 {
        color: #38bdf8;
        margin-bottom: 20px;
        border-bottom: 1px solid #334155;
        padding-bottom: 10px;
    }

.post-detail-content {
    min-height: 150px;
    padding: 15px;
    background: #1e293b;
    border-radius: 6px;
    line-height: 1.6;
    margin-top: 15px;
    white-space: pre-wrap;
}

.post-detail-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #334155;
    display: block;
}

.course-layout-hub {
    width: 100%;
    height: calc(100vh - 90px);
    position: relative;
    overflow: hidden;
}

.course-main-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

.course-sidebar {
    flex: 0 0 32%;
    background: #1e293b;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #334155;
    overflow: hidden;
}

.course-desc {
    color: #94a3b8;
    font-size: 13px;
    margin-top: -8px;
}

.course-gutter {
    width: 10px;
    background: #0f172a;
    cursor: col-resize;
    z-index: 10;
    position: relative;
}

    .course-gutter::after {
        content: '';
        position: absolute;
        left: 4px;
        top: 0;
        width: 2px;
        height: 100%;
        background: #334155;
        transition: background 0.2s;
    }

    .course-gutter:hover::after {
        background: #38bdf8;
        box-shadow: 0 0 8px #38bdf8;
    }

.course-map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #0f172a;
    gap: 10px;
}

#map {
    flex: 1;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #334155;
}

.course-chart-container {
    height: 200px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    box-sizing: border-box;
    padding: 10px 15px;
    position: relative;
}

#elevationChart {
    width: 100%;
    height: 100%;
}

#segmentCard {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.course-card {
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.course-card-header {
    padding: 10px 15px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    font-weight: bold;
    color: #38bdf8;
    font-size: 13px;
}

.course-meta-table, .course-segment-table {
    width: 100%;
    border-collapse: collapse;
}

    .course-meta-table td, .course-segment-table td, .course-segment-table th {
        padding: 10px 12px;
        font-size: 12.5px;
        border-bottom: 1px solid #334155;
    }

    .course-segment-table th {
        background: #1e293b;
        color: #94a3b8;
        position: sticky;
        top: 0;
        z-index: 1;
    }

.course-table-wrapper {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding-bottom: 10px;
    max-height: calc(100vh - 350px);
}

    .course-table-wrapper::-webkit-scrollbar {
        width: 6px;
    }

    .course-table-wrapper::-webkit-scrollbar-track {
        background: #0f172a;
    }

    .course-table-wrapper::-webkit-scrollbar-thumb {
        background: #334155;
        border-radius: 3px;
    }

        .course-table-wrapper::-webkit-scrollbar-thumb:hover {
            background: #38bdf8;
        }

.course-segment-row {
    cursor: pointer;
    transition: background 0.15s;
}

    .course-segment-row:hover {
        background: rgba(56, 189, 248, 0.08);
    }

.segment-vital-info {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.course-drop-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(15, 23, 42, 0.85);
    border: 4px dashed #38bdf8;
    color: #38bdf8;
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(4px);
}

.course-chart-tooltip {
    position: absolute;
    display: none;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11.5px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    min-width: 85px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.badge-hc {
    background: #ef4444;
    color: #fff;
}

.badge-cat1 {
    background: #f97316;
    color: #fff;
}

.badge-cat2 {
    background: #eab308;
    color: #0f172a;
}

.badge-cat3 {
    background: #a855f7;
    color: #fff;
}

.badge-cat4 {
    background: #64748b;
    color: #fff;
}

.badge-flat {
    background: #22c55e;
    color: #fff;
}

/* 유지파워/업힐 세부 테이블용 공통 반응형 가로 스크롤 컨테이너 */
.mobile-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
    border: 1px solid #334155;
}

    .mobile-table-scroll table {
        min-width: 600px;
    }

/* ====================================================
   📱 9. 반응형 브레이크포인트 통합 가이드 (Media Queries)
   ==================================================== */

/* [1] 랩톱 및 패드 규격 대응 (1024px 이하) */
@media (max-width: 1024px) {
    .calc-layout-hub {
        flex-direction: column;
    }

    .calc-mode-tabs {
        flex-direction: column !important;
        width: 100% !important;
        overflow-x: visible !important;
        margin-bottom: 16px;
    }

    .calc-mode-tab {
        text-align: center;
        padding: 14px 18px;
        font-size: 14px;
    }

        .calc-mode-tab.active {
            /*transform: translateX(3px);*/
        }

    .calc-wrapper {
        flex-direction: column !important;
        gap: 24px;
        width: 100% !important;
    }

    .calc-left,
    .calc-right {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* [2] 일반 스마트폰 규격 대응 (768px 이하) */
@media (max-width: 768px) {
    .navbar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 20px;
        padding-bottom: 2px;
    }
}

/* [3] 초소형 스마트폰 규격 대응 (480px 이하) */
@media (max-width: 480px) {
    .calc-left .input-group[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
}

/* Vue가 로드되기 전까지 v-cloak이 붙은 태그를 강제로 숨깁니다 */
[v-cloak] {
    display: none !important;
}
