/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 지도 컨테이너 */
.map-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

#vmap {
    width: 100%;
    height: 370px;
    border-radius: 15px;
    overflow: hidden;
}

/* 컨트롤 버튼들 */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* 데스크톱 컨트롤 */
.desktop-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 모바일 컨트롤 */
.mobile-controls {
    display: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn.primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.btn.secondary {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
}

.btn.accent {
    background: linear-gradient(45deg, #fd79a8, #e84393);
    color: white;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn.hidden {
    display: none;
}

/* 경로 그리기 컨트롤 */
.route-controls {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.route-controls h3 {
    color: #0984e3;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
}

.route-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.route-buttons .btn {
    min-width: 120px;
    margin: 2px;
}

/* 결과 카드 */
.result-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.result-card h3 {
    color: #00b894;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

#locationName {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 15px;
}

#locationDescription {
    font-size: 1.1rem;
    color: #636e72;
    margin-bottom: 25px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 즐겨찾기 목록 영역 */
.favorites-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 즐겨찾기 컨테이너 스크롤 스타일링 */
#favoritesContainer {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* 스크롤바 스타일링 */
#favoritesContainer::-webkit-scrollbar {
    width: 8px;
}

#favoritesContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#favoritesContainer::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#favoritesContainer::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.favorites-section h3 {
    color: #fd79a8;
    margin-bottom: 35px;
    font-size: 1.5rem;
    text-align: center;
}

/* 저장된 정보 영역 */
.saved-info {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.saved-info h3 {
    color: #00b894;
    margin-bottom: 25px;
    font-size: 1.5rem;
    text-align: center;
}

.route-info, .favorites-list {
    margin-bottom: 30px;
}

.route-info h4, .favorites-list h4 {
    color: #0984e3;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

#routeDetails {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    border-left: 4px solid #0984e3;
}

#routeDetails p {
    margin-bottom: 8px;
    color: #2d3436;
}

.favorite-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 4px solid #fd79a8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.favorite-item h5 {
    color: #2d3436;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.favorite-item p {
    color: #636e72;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.remove-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.remove-btn:hover {
    background: #ee5a24;
}

/* 헤더 컨테이너 */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    gap: 15px;
}

/* 햄버거 버튼 */
.hamburger-btn {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.hamburger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 사이드바 */
.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-sidebar-btn:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-content {
    padding: 20px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    color: #2d3436;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.sidebar-item:hover {
    background: #e3f2fd;
    border-color: #74b9ff;
    transform: translateX(5px);
}

.sidebar-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

.sidebar-text {
    font-weight: 500;
    font-size: 1.1rem;
}

/* 사이드바 배경 오버레이 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .header-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        position: absolute;
        top: 20px;
        right: 20px;
    }
    
    /* 데스크톱 컨트롤 숨기기 */
    .desktop-controls {
        display: none;
    }
    
    /* 모바일 컨트롤 표시 */
    .mobile-controls {
        display: flex;
        gap: 8px;
        justify-content: center;
        width: 100%;
    }
    
    .mobile-controls .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .route-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .route-buttons .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons .btn {
        width: 100%;
        max-width: 200px;
    }
    
    /* 모바일에서 기존 즐겨찾기 리스트 숨기기 */
    .favorites-section {
        display: none;
    }
    
    /* 모바일에서 팝업 최적화 */
    .popup-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .popup-header {
        padding: 20px 20px 15px 20px;
    }
    
    .popup-body {
        padding: 15px 20px 25px 20px;
    }
    
    .popup-favorite-item .popup-actions {
        flex-direction: row;
        gap: 8px;
    }
    
    .popup-favorite-item .btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 0.8rem;
        min-height: 38px; /* iOS 터치 최적화 */
    }
    
    .sidebar {
        width: 250px;
        right: -250px;
    }
    
    .sidebar.open {
        right: 0;
    }
    
    .sidebar-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .sidebar-icon {
        font-size: 1.3rem;
        margin-right: 12px;
    }
    
    .sidebar-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header-right {
        top: 15px;
        right: 15px;
    }
    
    .hamburger-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .sidebar {
        width: 220px;
        right: -220px;
    }
    
    .sidebar.open {
        right: 0;
    }
}

/* 즐겨찾기 팝업 */
.favorites-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.favorites-popup.show {
    display: flex;
    opacity: 1;
}

.popup-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.favorites-popup.show .popup-content {
    transform: translateY(0);
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 20px 30px;
    border-bottom: 1px solid #eee;
}

.popup-header h3 {
    color: #fd79a8;
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.popup-body {
    padding: 20px 30px 30px 30px;
}

.popup-favorite-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #fd79a8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.popup-favorite-item h5 {
    color: #2d3436;
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.popup-favorite-item p {
    color: #636e72;
    margin: 0 0 15px 0;
    font-size: 0.9rem;
}

.popup-favorite-item .popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.popup-favorite-item .btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}
