html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}

#map { width: 100%; height: 100%; }

/* --- 로딩 모달 --- */
#loading-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: white;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transition: opacity 0.5s ease-out;
}
#loading-modal.hidden {
    opacity: 0;
    pointer-events: none;
}
#loading-modal .identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
#loading-modal .walk-icon {
    width: 60px;
    height: 60px;
    fill: #4285F4;
}
#loading-modal h1 {
    font-size: 24px;
    color: #333;
    margin: 0;
}
#loading-modal #loading-error {
    font-size: 14px;
    color: #d9534f;
    margin-top: 15px;
    max-width: 80%;
    text-align: center;
}

/* --- 로딩 오버레이 --- */
#loader-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.6); z-index: 20; display: none; justify-content: center; align-items: center; }
.loader { border: 8px solid #f3f3f3; border-top: 8px solid #4285F4; border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- 상단 컨트롤 --- */
#controls-container { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; flex-direction: row; gap: 10px; align-items: center; background-color: white; padding: 10px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); flex-wrap: nowrap; }
#search-value { padding: 6px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; width: 60px; }
#search-btn { padding: 6px 10px; border: none; background-color: #4285F4; color: white; border-radius: 5px; font-size: 13px; font-weight: bold; cursor: pointer; transition: background-color 0.3s; white-space: nowrap; }
#search-btn:hover { background-color: #357ae8; }

.route-navigation {
    display: flex;
    gap: 6px;
}
.route-navigation button {
    padding: 6px 10px;
    border: none;
    background-color: #6c757d;
    color: white;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
.route-navigation button:hover {
    background-color: #5a6268;
}

/* --- 경로 정보 패널 --- */
#route-panel { position: absolute; bottom: 20px; left: 20px; z-index: 10; background-color: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); max-width: 300px; display: none; flex-direction: column; }
#route-info { font-size: 14px; }

/* --- 다른 추천 경로 패널 --- */
#alternative-routes-panel {
    position: absolute;
    bottom: 0; /* Stick to bottom */
    left: 0;
    width: 100%; /* Full width */
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2); /* Similar to bottom-sheet */
    z-index: 100; /* Higher z-index */
    transform: translateY(100%); /* Hidden by default */
    transition: transform 0.3s ease-out;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    padding: 5px; /* Further reduced padding */
    max-height: 50vh; /* Limit height to 50% of viewport height */
    overflow-y: auto; /* Enable scrolling */
    display: flex; /* Always flex, visibility controlled by transform */
    flex-direction: column;
    /* Removed justify-content: center; */
    align-items: flex-start; /* Align content to top */
}

#alternative-routes-panel.show {
    transform: translateY(0); /* Show the panel */
}

/* --- 모달 스타일 (Bottom Sheet) --- */
.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    transform: translateY(100%); /* Hidden by default */
    transition: transform 0.3s ease-out;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    display: flex; /* Use flex to center content */
    justify-content: center;
    align-items: flex-start; /* Align content to top within the sheet */
    padding-top: 5px; /* Reduced padding for content */
}

.bottom-sheet.show {
    transform: translateY(0); /* Show the sheet */
}

.bottom-sheet-content {
    width: fit-content; /* Adjust width to content */
    max-width: 300px; /* More compact max-width */
    max-height: 80vh; /* Limit height to 80% of viewport height */
    overflow-y: auto; /* Enable vertical scrolling if content exceeds max-height */
    padding: 8px; /* Reduced padding */
    display: flex;
    flex-direction: column;
    gap: 5px; /* Reduced gap between elements */
}

.bottom-sheet-content h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
    font-size: 18px;
}

#modal-route-info {
    font-size: 15px;
    text-align: center;
    /* min-height removed to reduce empty space */
}

/* Removed .modal-navigation and .modal-actions rules as they are no longer needed */

/* Modal buttons unified style */
.modal-buttons button {
    padding: 6px 10px; /* Unified padding with main search button */
    border: none;
    background-color: #4285F4; /* Consistent blue */
    color: white;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
.modal-buttons button:hover {
    background-color: #357ae8; /* Darker blue on hover */
}

#modal-cancel-btn {
    background-color: #6c757d; /* Grey for cancel */
}
#modal-cancel-btn:hover {
    background-color: #5a6268;
}

#alternative-routes-panel h3 {
    margin-top: 0;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 2px; /* Further reduced padding */
    margin-bottom: 2px; /* Further reduced margin */
}
.route-option {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-size: 13px;
}
.route-option:hover {
    background-color: #f9f9f9;
    border-color: #ddd;
}
.route-option.selected {
    background-color: #e6f7ff;
    border-color: #91d5ff;
    font-weight: bold;
}

#history-btn {
    padding: 6px 10px;
    border: none;
    background-color: #6c757d; /* Grey color */
    color: white;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

#history-btn:hover {
    background-color: #5a6268;
}

#history-btn.active {
    background-color: #4285F4; /* The same blue as the search button */
}
#history-btn.active:hover {
    background-color: #357ae8;
}

#history-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.history-item {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
}

.history-item:hover {
    background-color: #f0f0f0;
}

.history-item .date {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

#map-utils {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 10px;
}

#map-utils.show {
    display: flex; /* Show when .show class is present */
}

#recenter-map {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

#history-clear-btn {
    background-color: #dc3545; /* Red color for delete */
}
#history-clear-btn:hover {
    background-color: #c82333;
}

