/* ============== 아트런 스타일 ============== */


/* 페이지 타이틀 섹션 */

.page-title-section {
    position: relative;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.title-container h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.title-container p {
    font-size: 1rem;
    opacity: 0.9;
}

.admin-add-btn {
    position: absolute;
    top: 2rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-add-btn:hover {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
}


/* 안내 섹션 */

.info-section {
    padding: 2rem 1rem;
    background: #f8f9fa;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.info-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.info-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #333;
}

.info-content p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}


/* 경로 목록 섹션 */

.routes-list-section {
    padding: 0 1rem 2rem 1rem;
    /* ✨ 상단 완전히 제거 */
    min-height: 400px;
}

.section-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem;
    /* ✨ 1.5rem → 1rem */
    margin-top: 0;
    /* ✨ 추가 */
    flex-wrap: wrap;
    gap: 1rem;
    text-align: left !important;
}

.section-header h2,
.section-header h3 {
    text-align: left !important;
    margin-right: auto;
}


/* 필터 버튼 */

.filter-buttons {
    display: flex;
    gap: 0.8rem;
    /* ✨ 0.5rem → 0.8rem */
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}


/* 경로 컨테이너 */

.routes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}


/* 경로 카드 */

.route-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.route-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.route-card-image {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    /* ✨ 배경색 변경 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.route-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.route-card-body {
    padding: 1.5rem;
}

.route-card-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 0.5rem;
}

.route-card-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.route-card-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    color: #666;
}

.route-stat-icon {
    font-size: 1rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.difficulty-easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-hard {
    background: #f8d7da;
    color: #721c24;
}

.route-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-icon {
    padding: 0.7rem;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #e9ecef;
}

.btn-edit {
    color: #667eea;
}

.btn-delete {
    color: #dc3545;
}

.btn-edit:hover {
    background: rgba(102, 126, 234, 0.1);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.1);
}


/* 로딩 스피너 */

.loading-spinner {
    text-align: center;
    padding: 4rem 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* 빈 상태 */

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #999;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    color: #999;
}


/* 모달 */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}


/* 폼 스타일 */

.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: #999;
}

.text-muted {
    color: #999;
    font-size: 0.9rem;
}


/* 지도 스타일 */

.route-map {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.detail-map {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    margin-bottom: 1.5rem;
}

.map-instructions {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.map-instructions p {
    margin-bottom: 0.8rem;
    color: #666;
}

.map-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.latlng-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.latlng-input-row input[type="number"] {
    width: 180px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}


/* ✨ 시작-끝 연결 버튼 스타일 */

#connectPointsBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 600;
}

#connectPointsBtn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#connectPointsBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 그리기 모드 토글 */

.draw-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.draw-mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f5f5f5;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.draw-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.draw-mode-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

/* 그리기 모드일 때 지도 커서 */
.route-map.draw-cursor {
    cursor: crosshair;
}

.point-count {
    margin-left: auto;
    font-size: 0.9rem;
    color: #666;
}

.point-count strong {
    color: #667eea;
    font-size: 1.1rem;
}


/* 웨이포인트 목록 */

.waypoints-list {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.waypoint-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.waypoint-info {
    flex: 1;
}

.waypoint-coords {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 0.3rem;
}

.waypoint-instruction {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}


/* 경로 상세 정보 */

.route-detail-info {
    display: grid;
    gap: 1rem;
}

.detail-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-info-label {
    font-weight: 600;
    color: #666;
}

.detail-info-value {
    font-weight: 700;
    color: #333;
}


/* 반응형 */

@media (max-width: 768px) {
    .routes-container {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-buttons {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .admin-add-btn {
        position: static;
        margin-top: 1rem;
        width: 100%;
    }
    .page-title-section {
        padding-bottom: 1rem;
    }
    .info-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .title-container h1 {
        font-size: 1.5rem;
    }
    .route-card-title {
        font-size: 1.1rem;
    }
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .route-map,
    .detail-map {
        height: 300px;
    }
}


/* ============== 강제 오버라이드 (충돌 방지) ============== */


/* ============== 편집 버튼 강제 정렬 ============== */

.section-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
}


/* 제목은 왼쪽 */

.section-header h2,
.section-header h3 {
    flex: 0 0 auto !important;
    text-align: left !important;
    margin: 0 !important;
}


/* 편집 버튼은 오른쪽 */

.section-header button,
.section-header .edit-btn,
.section-header .edit-button,
.section-header a {
    margin-left: auto !important;
}


/* ✨ 카드 내 지도 스타일 */

.route-card-map {
    width: 100%;
    height: 200px;
    /* ✨ 명시적 높이 지정 */
    position: relative;
}


/* 지도 위 클릭 방지 오버레이 (카드 클릭만 되도록) */

.route-card-map::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 10;
    cursor: pointer;
}


/* ============== 필터 섹션 ============== */

.filter-section {
    margin-bottom: 1.5rem;
}


/* 검색창 */

.search-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.8rem 2.5rem 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #999;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #e0e0e0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background: #d0d0d0;
    color: #333;
}


/* 필터 드롭다운들 */

.filter-dropdowns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* ✨ 항상 2열 */
    gap: 0.8rem;
}

.filter-select {
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
}

.filter-select:hover {
    border-color: #667eea;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}


/* 반응형 */

@media (max-width: 768px) {
    .search-input {
        font-size: 0.95rem;
    }
    .filter-select {
        font-size: 0.9rem;
        padding: 0.7rem 0.8rem;
    }
}


/* 검색 결과 없음 */

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-results h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #666;
    margin-bottom: 0.5rem;
}

.no-results p {
    font-size: 1rem;
    color: #999;
}


/* 반응형 */

@media (max-width: 768px) {
    .search-input {
        font-size: 0.95rem;
    }
}


/* ============== 관리자 경로 추가 버튼 스타일 ============== */

.admin-add-btn {
    position: fixed;
    top: 2rem;
    right: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 100;
}

.admin-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.admin-add-btn:active {
    transform: translateY(0);
}


/* 반응형 */

@media (max-width: 768px) {
    .admin-add-btn {
        position: static;
        margin: 1rem auto;
        display: block;
        width: calc(100% - 2rem);
    }
}


/* ============== 상세 모달 버튼 스타일 수정 ============== */


/* 상세 모달 푸터 */

#routeDetailModal .modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}


/* 닫기 버튼 */

#detailModalCancelBtn {
    padding: 0.8rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: #f8f9fa;
    color: #666;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

#detailModalCancelBtn:hover {
    background: #e9ecef;
    border-color: #d0d0d0;
    color: #333;
}


/* 시작하기 버튼 */

#startRunBtn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

#startRunBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#startRunBtn:active {
    transform: translateY(0);
}


/* ============== 경로 추가/수정 모달 버튼 스타일 ============== */


/* 경로 추가 모달 푸터 */

#routeModal .modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}


/* 취소 버튼 */

#modalCancelBtn {
    padding: 0.8rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: #f8f9fa;
    color: #666;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

#modalCancelBtn:hover {
    background: #e9ecef;
    border-color: #d0d0d0;
    color: #333;
}


/* 저장 버튼 */

#saveRouteBtn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

#saveRouteBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#saveRouteBtn:active {
    transform: translateY(0);
}

#saveRouteBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ============== 구간 수정 패널 ============== */

.segment-edit-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #e0e5ff;
}

.segment-edit-panel h4 {
    margin: 0 0 0.8rem 0;
    font-size: 0.95rem;
    color: #333;
}

.segment-edit-panel h4 small {
    font-weight: 400;
    color: #888;
    font-size: 0.8rem;
}

.segment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.segment-item.editing {
    border-color: #667eea;
    background: #f0f3ff;
}

.segment-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.segment-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.segment-distance {
    font-size: 0.8rem;
    color: #888;
}

.segment-btns {
    display: flex;
    gap: 0.4rem;
}

.btn-segment-edit {
    padding: 0.4rem 0.8rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-segment-edit:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
}

.btn-segment-add-wp {
    padding: 0.4rem 0.8rem;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-segment-add-wp:hover {
    background: #38a169;
    transform: translateY(-1px);
}

/* ============== 도보 경로 연결 버튼 ============== */

#autoRouteBtn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#autoRouteBtn:hover {
    background: #43A047;
    transform: translateY(-1px);
}

#autoRouteBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 앵커 웨이포인트 강조 */

.waypoint-item.anchor-waypoint {
    border-left: 3px solid #667eea;
    background: #f8f9ff;
}