* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    /* Lock the body completely */
    overflow: hidden; 
    overscroll-behavior: none;
    font-family: 'Arial', sans-serif;
}

.container {
    /* Absolute lock to viewport */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

.sidebar {
    width: 350px;
    background-color: #f9f9f9;
    border-right: 1px solid #ccc;
    /* Flex column to manage internal scrolling */
    display: flex;
    flex-direction: column;
    z-index: 2; 
    transition: transform 0.3s ease-in-out;
}

/* Sidebar Header Area (Static) */
.sidebar > h1, 
.sidebar > .input-group,
.sidebar > #view-map-btn {
    flex-shrink: 0; 
    margin-left: 20px;
    margin-right: 20px;
    width: calc(100% - 40px); /* Explicit width to match list padding */
}

.sidebar > h1 { margin-top: 20px; }

/* The Scrollable List (Takes remaining space) */
#attractions-list {
    flex: 1; 
    overflow-y: auto; 
    padding: 0 20px; 
    min-height: 0; 
}

/* Sidebar Footer Area (Static) */
.actions {
    flex-shrink: 0; 
    padding: 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
}

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

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Input Styles */
#address-input, #place-search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 0; /* Allow shrinking in flex */
}

button {
    padding: 10px 15px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap; /* Prevent button text wrap */
}

button:hover { background-color: #357ae8; }

#view-map-btn {
    margin-bottom: 20px;
    width: calc(100% - 40px);
}

#download-btn {
    width: 100%;
    padding: 12px;
    background-color: #34a853;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#download-btn:disabled { background-color: #ccc; cursor: not-allowed; }

/* Item Styles */
.attraction-item {
    background-color: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for mode selector */
    align-items: center;
    gap: 10px;
    width: 100%; /* Fill the list width */
}
.attraction-item:hover { background-color: #f0f0f0; }
.attraction-item.selected { border-left: 5px solid #4285f4; background-color: #e8f0fe; }
.attraction-icon { font-size: 24px; color: #555; }
.attraction-info { flex: 1; min-width: 0; }
.attraction-name { font-weight: bold; display: block; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attraction-type { font-size: 12px; color: #666; display: block; }
.route-info { font-size: 12px; color: #4285f4; margin-top: 5px; display: block; }
.placeholder-text { color: #888; text-align: center; margin-top: 50px; }

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-left: auto; /* Push to right */
    padding-left: 10px;
}

.mode-btn {
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.mode-btn:hover { background-color: #ddd; color: #666; }
.mode-btn.active { color: #4285f4; background-color: #d2e3fc; }

/* Mobile Responsiveness */
.mobile-toggle-btn { display: none !important; }

@media (max-width: 1100px) {
    .container {
        display: block; 
        overflow: hidden; 
    }

    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%; 
        border-right: none;
        z-index: 1000;
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }

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

    .mobile-toggle-btn { display: block !important; }
    
    #show-list-btn {
        display: block !important;
        position: fixed; 
        bottom: 90px; 
        right: 20px;
        z-index: 500;
        padding: 12px 20px;
        border-radius: 30px;
        font-weight: bold;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    }
}