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

body {
    background-color: #0f172a; /* 전체 배경색 (어두운 네이비 다크모드) */
    color: #f8fafc; /* 기본 글자색 (밝은 회색 계열) */
}

/* ====================================================
   🌐 2. 상단 네비게이션 바 (Top Navigation Bar)
   ==================================================== */
.navbar {
    background-color: #1e293b; /* 네비게이션 바 배경색 */
    padding: 15px 20px;
    position: sticky; /* 스크롤을 내려도 상단에 칼같이 고정 */
    top: 0;
    z-index: 10; /* 다른 본문 콘텐츠보다 무조건 위에 노출 */
}

.navbar-container {
    max-width: 1550px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    /* 💡 수정 1: 양끝 분할을 풀고, 왼쪽부터 차곡차곡 쌓이도록 정렬 기준을 바꿉니다 */
    justify-content: flex-start;
    /* 💡 수정 2: 자식 요소(로고와 탭 메뉴) 사이의 간격을 칼같이 50px로 고정합니다 */
    gap: 50px;
}

.navbar-logo {
    color: #38bdf8; /* VeloLab 로고 시그니처 하늘색 */
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
}

.tab-menu {
    display: flex;
    list-style: none;
    gap: 20px; /* 메뉴 글자 사이의 간격 */
}

    .tab-menu a {
        color: #94a3b8; /* 비활성화된 기본 탭 글자색 */
        cursor: pointer;
        font-weight: 600;
        padding: 5px 10px;
        text-decoration: none;
    }

        /* 현재 내가 들어와 있는 활성 탭 하이라이트 */
        .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;
}

/* 🏁 속도계산기 최외곽 프레임 (왼쪽 세로 메뉴 탭바 + 우측 본문 가로 정렬) */
.calc-layout-hub {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 20px;
    align-items: flex-start;
}

/* 🏁 인풋 폼 영역과 우측 대시보드 차트 영역을 가로로 정렬하는 랩퍼 */
.calc-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: space-between;
    flex: 1;
}

/* 왼쪽 기입 상자 */
.calc-left {
    flex: 1.5; /* 우측 차트보다 가로 비중을 1.5배 크게 설정 */
    width: 100%;
    background: #0f172a;
    padding: 25px;
    border-radius: 12px; /* 모서리 둥글기 */
    border: 1px solid #334155;
}

/* 오른쪽 실시간 가이드/인사이트 상자 */
.calc-right {
    flex: 2.5; /* 대형 차트 수용을 위해 가로 비율 확장 */
    width: 100%;
    background: #0f172a;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #334155;
    text-align: center;
    position: sticky; /* 스크롤을 내려도 오른쪽 안내판은 화면에 고정 내장 */
    top: 80px;
    z-index: 5;
}

/* 모바일 및 태블릿 환경 반응형 처리 (화면 폭 1000px 이하일 때 세로로 자동 정렬) */
@media (max-width: 1000px) {
    .calc-layout-hub {
        flex-direction: column;
    }

    .calc-wrapper {
        flex-direction: column;
        gap: 20px;
    }
}

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

.calc-mode-tab {
    width: 100%;
    padding: 14px 18px;
    text-align: left;
    background: #0f172a;
    color: #64748b;
    border: 1px solid #334155;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease; /* 마우스 올리거나 활성화될 때 애니메이션 부드럽게 */
}

    /* 계산기 세로 메뉴가 활성화되었을 때 슬라이딩 하이라이트 효과 */
    .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); /* 우측으로 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;
}

.gear-matrix-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    color: #cbd5e1;
    table-layout: fixed; /* 모든 열의 너비를 균등하게 고정하여 깨짐 방지 */
    font-size: 14px; /* 가독성을 높인 대형화 폰트 사이즈 */
}

    .gear-matrix-table th {
        background: #0f172a;
        color: #cbd5e1;
        font-weight: bold;
        white-space: nowrap; /* 화면 좁아져도 T수 텍스트 줄바꿈 강제 방지 */
        padding: 12px 2px;
    }

    /* 좌측 행 타이틀 (앞 크랭크 체인링 목록 열) */
    .gear-matrix-table td.front-header-cell {
        background: #0f172a;
        color: #38bdf8;
        font-weight: bold;
        font-size: 13px;
        border-right: 1px solid #334155;
    }

    .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; /* 투명도 15% 연두색 배경 */
        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. 자유게시판 시스템 레이아웃 (Forum & Board)
   ==================================================== */
/* 자유게시판 탭 전용 가로 크기 제어 허브 (중앙 정렬 밸런스) */
.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; /* 가독성을 높이기 위해 줄 간격을 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;
}

/* ====================================================
   🚴‍♂️ 8. 코스 분석기 대시보드 전용 레이아웃 (Course Analyst)
   ==================================================== */
.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 35%; /* 초기 세로분할 비율 지정 */
    background: #1e293b;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #334155;
}

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

/* 중앙 조절 거터 스플리터 */
.course-gutter {
    width: 8px;
    background: #0f172a;
    cursor: col-resize;
    z-index: 10;
    transition: background 0.1s;
}

    .course-gutter:hover {
        background: #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%;
}

.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;
    /* 💡 [버그 해결] 하드코딩된 max-height를 지우고 자율 확장을 주어 하단 짤림을 원천 차단합니다! */
    width: 100%;
    padding-bottom: 15px; /* 최하단 스크롤 시 마지막 줄이 숨 쉴 여백 공간 배정 */
}

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

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

/* 파일 업로드 드롭존 수식 */
.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);
}


/* ====================================================
   ⛰️ 코스 분석기 산악 등급 뱃지 & 스크롤 기능 복구
   ==================================================== */

/* 1. 산악 등급 공통 뱃지 스타일 */
.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);
}

/* 2. 등급별 시그니처 컬러 매핑 */
.badge-hc {
    background: #ef4444;
    color: #fff;
}
/* 최고 존엄 HC 등급 (붉은색) */
.badge-cat1 {
    background: #f97316;
    color: #fff;
}
/* 1등급 업힐 (주황색) */
.badge-cat2 {
    background: #eab308;
    color: #0f172a;
}
/* 2등급 업힐 (노란색) */
.badge-cat3 {
    background: #a855f7;
    color: #fff;
}
/* 3등급 업힐 (보라색) */
.badge-cat4 {
    background: #64748b;
    color: #fff;
}
/* 4등급 업힐 (회색) */
.badge-flat {
    background: #22c55e;
    color: #fff;
}
/* 평지 / 낙타등 (녹색) */

/* 3. 좌측 산악 목록 세로 스크롤 기능 복구 및 제한폭 설정 */
.course-table-wrapper {
    flex: 1;
    overflow-y: auto;
    /* 💡 레이아웃이 무너지지 않도록 우측 지도 높이에 맞춰 스크롤 한계선 고정 */
    max-height: calc(100vh - 350px);
}

    /* 4. 다크모드 대시보드에 어울리는 슬림 스크롤바 커스텀 */
    .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; /* 마우스 올리면 시그니처 하늘색으로 발광 */
        }

/* ====================================================
   💎 bicyclerab 코스분석기 레이아웃 보정 및 거터 바 강조
   ==================================================== */

/* 좌측 사이드바 자체의 뷰포트 고정 (내부 요소 짤림 방지 방어벽) */
.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; /* 사이드바 자체가 스크롤되는 것을 차단 */
}

/* 💡 [스크롤 복구] 산악 리스트 카드를 유연 플렉스로 지정 */
#segmentCard {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 💡 [스크롤 복구] 테이블 래퍼가 남은 공간을 다 먹고 스크롤바를 강제 생성하도록 마감 */
.course-table-wrapper {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding-bottom: 10px;
}

/* 💡 [조절바 강조] 중앙 거터바에 네온 센터라인 슬롯 가공 */
.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;
    }

/* 구간 데이터 정렬 서브 라벨 */
.segment-vital-info {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}