/* 홈 페이지 전용 스타일 */
/* 주소 검색 자동완성 스타일 */
.address-input-container {
    position: relative;
    width: 100%;
}

.address-input {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border1: 1px solid #3267f5;
    border: 1px solid #799af3;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

.address-input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.address-input.searching {
    border-color: #FFA500;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #666;
    pointer-events1: none;
}

.search-icon.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* 검색 결과 드롭다운 */
.address-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.address-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.address-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.address-item:last-child {
    border-bottom: none;
}

.address-item:hover {
    background: #f8f9fa;
}

.address-item.selected {
    background: #F0F8FF;
    color: #007AFF;
}

.address-main {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.address-sub {
    font-size: 12px;
    color: #666;
}

.address-category {
    display: inline-block;
    background: #e9ecef;
    color: #6c757d;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 6px;
}

/* 에러 상태 */
.address-error {
    padding: 12px 16px;
    color: #FF3838;
    font-size: 14px;
    text-align: center;
}

/* 결과 없음 */
.address-empty {
    padding: 12px 16px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* 현재 위치 버튼 (지도 중심점용) */
.current-location-btn {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.current-location-btn:hover {
    background: #f0f0f0;
}

/* GPS 위치 아이콘 스타일  */
.gps-location-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top1: 2px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
    z-index: 10;
}

.gps-location-icon:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.gps-location-icon:active {
    transform: translateY(-50%) scale(0.95);
}

/* 선택된 주소 표시 */
.selected-address-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e8f5e8;
    border-radius: 6px;
    font-size: 12px;
    color: #2E7D32;
    display: none;
}

.selected-address-info.show {
    display: block;
}

/* 키보드 네비게이션 하이라이트 */
.address-item.keyboard-selected {
    background: #F0F8FF;
    outline: 2px solid #007AFF;
}

/* 모바일 환경을 위한 추가 스타일 */
@media (max-width: 480px) {
   .address-dropdown {
       position: absolute;
       height: 800px;
       top: 100%;
       bottom: 0;
       left: 0;
       right: 0;
       max-height: 70vh;
       border-radius: 12px;
       box-shadow1: 0 -4px 20px rgba(0,0,0,0.25);
   }

   .address-item {
       padding: 10px;
       font-size: 16px; /* 모바일에서 더 큰 터치 영역 */
   }

   /* 가상 키보드를 위한 여백 */
   .address-input:focus {
       scroll-margin-top: 100px;
   }
 }


/* 네이티브 네비게이션 전환 알림 */
.native-nav-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    display: none;
    text-align: center;
}

.native-nav-notice.show {
    display: block;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* 개발용 테스트 컨트롤 */
.native-test-controls {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 9998;
    display: none;
}

.native-test-controls.show {
    display: block;
}

.test-btn {
    display: block;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    min-width: 60px;
    text-align: center;
    transition: all 0.2s ease;
}

.test-btn:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 메인 컨테이너 */
.main-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    transform: translateZ(0);
    will-change: transform;
}

.main-container.native-nav-mode {
    padding-bottom: 0;
}

/* 페이지 컨테이너 */
.page-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
}

/* 홈 페이지 상단 버튼들 */
.home-top-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 4px;
}

.location-btn {
    flex: 1;
    padding: 10px 10px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: white;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.location-btn:active {
    transform: scale(0.98);
}

.location-btn.start-btn {
    border-color: #007AFF;
    background: linear-gradient(135deg, #F0F8FF 0%, #E3F2FD 100%);
    color: #007AFF;
}

.location-btn.start-btn:hover {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    box-shadow: 0 4px 12px rgba(0,122,255,0.2);
}

.location-btn.end-btn {
    border-color: #FF3838;
    background: linear-gradient(135deg, #FFF0F0 0%, #FFEBEE 100%);
    color: #FF3838;
}

.location-btn.end-btn:hover {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    box-shadow: 0 4px 12px rgba(255,56,56,0.2);
}


/* 새로 추가: 검색 버튼 스타일 */
.location-btn.search-btn-style {
  width:100%;
  color: white;
  background: #668ff9;
  border: 1px solid #7f9df1;
}

.location-btn.search-btn-style:hover {
    background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C8 100%);
    box-shadow: 0 4px 12px rgba(76,175,80,0.2);
}

/* 새로 추가: 주문 버튼 스타일 */
.location-btn.order-btn-style {
  border-color1: #3579ff;
  background: #4c94ff;
  color: #ffffff;
  border: 1px solid #3579ff;
}

.location-btn.order-btn-style:hover {
    background: linear-gradient(135deg, #FFECB3 0%, #FFD54F 100%);
    box-shadow: 0 4px 12px rgba(255,152,0,0.2);
}

/* 경로 검색 섹션 */
.route-search-section {
    background1: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 0px 5px;
    margin-bottom1: 20px;
    border1: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.route-search-section .form-group{
  margin-bottom:12px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 검색 버튼 */
.search-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,122,255,0.3);
    text-align: center;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,122,255,0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}


/* 경로 결과 테이블 스타일 */
.summary-table {
    width: 100%;
    text-align: center;
    background: white;
    padding1: 16px;
    border-radius: 12px;
    box-shadow1: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #c0c2c4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-header {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    padding: 8px 4px;
    border-bottom: 1px solid #e9ecef;
}

.summary-row.values {
    margin-top: 0px;
}

.summary-row.values .summary-value {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    padding: 8px 4px;
}

#routeDuration::after {
    content: '분';
    font-size: 12px;
    color: #666;
    margin-left: 2px;
}

#routeDistance::after {
    content: 'km';
    font-size: 12px;
    color: #666;
    margin-left: 2px;
}

#routeDeliveryFee1::after {
    content: '원';
    font-size: 12px;
    color: #666;
    margin-left: 2px;
}

.route-loading {
    text-align: center;
    padding: 16px;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 8px;
    margin-top: 12px;
    color: #007AFF;
}

.loading-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    font-size: 20px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 경로 결과 */
.route-results {
    background1: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius1: 16px;
    padding1: 16px;
    margin-top1: 16px;
    display1: none;
    border1: 1px solid #e9ecef;
    box-shadow1: 0 2px 8px rgba(0,0,0,0.05);
}

.route-summary {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    border-left1: 4px solid #007AFF;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.route-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background1: linear-gradient(90deg, #007AFF 0%, #0051D5 100%);
    border-radius: 12px 12px 0 0;
}

.route-summary strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.route-summary > div {
    color: #666;
    line-height: 1.6;
}

/* 경로 검색 에러 영역 */
.route-results-error {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 12px;
    padding: 30px 20px;
    margin: 15px 0;
    text-align: center;
}

.route-results-error .error-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.route-results-error .error-title {
    font-size: 16px;
    font-weight: 500;
    color: #ff3838;
    margin-bottom: 5px;
}

.route-results-error .error-message {
    font-size: 13px;
    color: #999;
}

.route-results-error .retry-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.route-results-error .retry-btn:hover {
    background: #0056b3;
}

/* 페이지 전환 효과 */
.page {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.page.active {
    display: block;
    opacity: 1;
}

/* 로딩 상태 */
.loading-route {
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

.loading-route::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 에러 상태 */
.route-error {
    text-align: center;
    padding: 20px;
    color: #ff3838;
    background: #fff0f0;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    .home-top-buttons {
      display: flex;
      gap: 12px;
      margin-bottom: 12px;
      padding: 4px;
    }

    .location-btn {
        padding: 10px 12px;
        font-size: 15px;
    }

    .route-search-section {
        background1: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        padding1: 16px;
    }

    .search-btn {
        padding: 16px;
        font-size: 15px;
    }

    .route-summary {
        padding: 16px;
    }

    .native-test-controls {
        top: 70px;
        right: 8px;
    }

    .test-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 50px;
    }
}

/* 다크모드 지원 (향후 확장) */
@media (prefers-color-scheme: dark1) {
    .route-search-section {
        background1: linear-gradient(135deg, #2c2c2e 0%, #1c1c1e 100%);
        border-color: #3a3a3c;
    }

    .section-title {
        color: #ffffff;
    }

    .route-summary {
        background: #2c2c2e;
        color: #ffffff;
    }

    .route-summary strong {
        color: #ffffff;
    }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    .location-btn,
    .search-btn,
    .page {
        transition: none;
    }

    .native-nav-notice.show {
        animation: none;
    }

    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        50% { opacity: 1; }
    }
}
