@charset "UTF-8";

/* ==========================================
   1. 기본 스타일 리셋 및 베이스 정의
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* 상단 네비게이션 헤더 */
header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .site-logo {
    max-width: 1100px;
    margin: 0 auto;
    font-size: 1.4rem;
    font-weight: 800;
    color: #e50914;
    letter-spacing: -0.05rem;
}

/* ==========================================
   2. 메인 레이아웃 및 검색 폼 구성
   ========================================== */
.main-container {
    max-width: 800px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* 히어로 섹션 */
.hero-section {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #111111;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03rem;
}

.hero-section p {
    color: #6c757d;
    font-size: 1rem;
    word-break: keep-all;
}

/* 검색 카드 박스 */
.search-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background-color: #fdfdfd;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
}

.form-group select:focus {
    border-color: #e50914;
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
}

.form-group select:disabled {
    background-color: #e9ecef;
    opacity: 0.6;
    cursor: not-allowed;
}

.form-swap-btn {
    text-align: center;
    color: #adb5bd;
    font-size: 1.3rem;
    margin: -0.3rem 0;
    user-select: none;
}

.btn-search {
    width: 100%;
    padding: 1.1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    background-color: #e50914;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.btn-search:hover {
    background-color: #c40810;
}

/* ==========================================
   3. PC/태블릿 기준 기본 결과 레이아웃
   ========================================== */
.result-section {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.01);
}

.result-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #212529;
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
}

.loc-badge {
    padding: 0.2rem 0.8rem;
    border-radius: 6px;
    font-weight: 700;
}
.loc-badge.dep { background-color: #e8f4fd; color: #007bff; }
.loc-badge.arr { background-color: #fcedee; color: #e50914; }
.result-header .arrow { color: #adb5bd; }
.info-meta { color: #6c757d; font-size: 0.95rem; font-weight: 500; }

.responsive-table {
    width: 100%;
}

.timetable-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.timetable-table th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.95rem;
}

.timetable-table td {
    padding: 1.1rem 1rem;
    border-bottom: 1px solid #f1f3f5;
    color: #343a40;
}

.timetable-table tr:hover td {
    background-color: #fafafa;
}

.time-cell strong {
    font-size: 1.15rem;
    color: #111;
}
.time-cell.arr-time {
    color: #868e96;
}

.price-cell {
    font-weight: 700;
    color: #212529;
}

/* 버스 등급별 뱃지 */
.grade-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    background-color: #e9ecef;
    color: #495057;
}
.grade-badge.우등 { background-color: #e3f2fd; color: #0d47a1; }
.grade-badge.프리미엄 { background-color: #fff8e1; color: #ff8f00; }
.grade-badge.심야우등, .grade-badge.심야프리미엄 { background-color: #343a40; color: #fff; }

.no-data-box {
    text-align: center;
    padding: 3rem 1rem;
    color: #868e96;
}

/* 주요 링크 허브 */
.hub-section {
    border-top: 1px solid #e9ecef;
    padding-top: 2rem;
}

.hub-section h3 {
    font-size: 1.05rem;
    color: #343a40;
    margin-bottom: 1rem;
    font-weight: 600;
}

.hub-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hub-tags .tag-shortcut {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 30px;
    color: #495057;
    transition: all 0.2s;
}

.hub-tags .tag-shortcut:hover {
    border-color: #e50914;
    color: #e50914;
    background-color: rgba(229, 9, 20, 0.02);
}

footer {
    background-color: #ffffff;
    padding: 2.5rem 1rem;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.7;
}

/* ==========================================
   4. 모바일 전용 최적화 가독성 뷰 (768px 이하)
   ========================================== */
@media (max-width: 768px) {
    .main-container {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    header {
        padding: 1rem 0.75rem;
    }

    .hero-section h1 {
        font-size: 1.6rem;
    }

    .search-card {
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    .form-group select {
        padding: 0.85rem;
        font-size: 1rem;
    }

    .btn-search {
        padding: 1rem;
        font-size: 1.05rem;
    }

    .result-section {
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    .result-header h2 {
        font-size: 1.3rem;
        width: 100%;
        justify-content: center;
    }
    
    .result-header {
        text-align: center;
        justify-content: center;
    }

    /* 모바일 카드식 레이아웃 변환 */
    .timetable-table thead {
        display: none;
    }

    .timetable-table, 
    .timetable-table tbody, 
    .timetable-table tr, 
    .timetable-table td {
        display: block;
        width: 100%;
    }

    .timetable-table tr {
        background-color: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 1rem;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 0.5rem 0;
    }

    .timetable-table tr:hover td {
        background-color: transparent;
    }

    .timetable-table td {
        padding: 0 !important;
        border: none !important;
        text-align: left;
    }

    /* 1행 좌측: 출발 시간 */
    .timetable-table td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    .timetable-table td:nth-child(1) strong::before {
        content: "출발 ";
        font-size: 0.8rem;
        color: #868e96;
        font-weight: normal;
    }
    .time-cell strong {
        font-size: 1.3rem;
        color: #e50914;
    }

    /* 1행 우측: 도착 시간 */
    .timetable-table td:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
        font-size: 1rem;
    }
    .timetable-table td:nth-child(2)::before {
        content: "도착예정 ";
        font-size: 0.8rem;
        color: #868e96;
    }
    .timetable-table td.arr-time {
        color: #212529;
        font-weight: 600;
    }

    /* 2행 좌측: 버스 등급 (독립 노출) */
    .timetable-table td:nth-child(4) {
        grid-column: 1;
        grid-row: 2;
        display: flex;
        align-items: center;
        margin-top: 0.2rem;
    }

    /* 2행 내부에서 소요시간을 가상요소 텍스트로 보완하도록 수정 */
    .timetable-table td:nth-child(3) {
        display: none;
    }

    /* 2행 우측: 요금 표기 */
    .timetable-table td:nth-child(5) {
        grid-column: 2;
        grid-row: 2;
        text-align: right;
        font-size: 1.15rem;
        font-weight: 800;
        color: #111111;
    }
}

/* 실시간 예매 안내 배너 스타일 */
.booking-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.booking-text strong {
    display: block;
    font-size: 1.05rem;
    color: #212529;
    margin-bottom: 0.2rem;
}

.booking-text p {
    font-size: 0.85rem;
    color: #6c757d;
}

.booking-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-booking {
    display: inline-block;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 6px;
    text-align: center;
    transition: background-color 0.15s;
}

.btn-booking.tmoney {
    background-color: #ff5252;
    color: #ffffff;
}
.btn-booking.tmoney:hover { background-color: #e04545; }

.btn-booking.bustago {
    background-color: #448aff;
    color: #ffffff;
}
.btn-booking.bustago:hover { background-color: #3b76db; }

/* 모바일 환경 최적화 */
@media (max-width: 768px) {
    .booking-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 1rem;
    }
    .booking-actions {
        flex-direction: column;
        width: 100%;
    }
    .btn-booking {
        width: 100%;
        padding: 0.8rem;
    }
}

