:root {
    --bg-color-dark: #121212;
    --surface-color-dark: #1e1e1e;
    --text-color-primary: #e0e0e0;
    --text-color-secondary: #b0b0b0;
    --primary-color: #bb86fc; /* Purple */
    --accent-color: #03dac6; /* Teal */
    --error-color: #cf6679; /* Red */
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --hover-bg: #2a2a2a;
    --active-bg: #3a3a3a;
}

body {
    font-family: 'Roboto', sans-serif; /* A common, clean font */
    margin: 0;
    padding: 0;
    background-color: var(--bg-color-dark);
    color: var(--text-color-primary);
    overflow: hidden; /* Prevent body scroll when overlays are active */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Material Icons Integration */
.material-icons {
    vertical-align: middle;
    font-size: 20px; /* Default icon size */
}

/* Base screen container styles - NO ANIMATIONS */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color-dark);
    display: none; /* Hidden by default */
    flex-direction: column;
    box-sizing: border-box;
    padding: 20px;
    overflow-y: auto; /* Allow scrolling for content that exceeds screen height */
    z-index: 10; /* Default z-index for content screens */
}

/* Active screen state - display it instantly */
.screen.active {
    display: flex; /* Show the screen */
}

/* Overlays should still be on top of base screens */
.screen.overlay {
    z-index: 20; /* Overlays appear on top */
}

/* The initial main screen, always starts visible */
#mainScreen {
    display: flex; /* Main screen is initially visible */
}

/* Main Screen Specific Styles */
#mainScreen {
    padding-top: 50px; /* Adjust for title */
    justify-content: flex-start;
    align-items: center;
}

.app-title {
    color: var(--primary-color);
    margin-bottom: 40px;
    font-size: 2.5em;
    text-align: center;
}

.input-group {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.location-input {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--surface-color-dark);
    color: var(--text-color-primary);
    font-size: 1.1em;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease-in-out;
}

.location-input::placeholder {
    color: var(--text-color-secondary);
}

.location-input:focus {
    border-color: var(--primary-color);
}

.action-btn {
    width: 100%;
    max-width: 400px;
    padding: 15px 20px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    box-sizing: border-box;
}

.action-btn.primary-btn {
    background-color: var(--primary-color);
    color: var(--bg-color-dark);
    font-weight: bold;
}

.action-btn.primary-btn:hover {
    background-color: #a06dfc; /* Slightly darker purple */
}

.action-btn:active {
    transform: scale(0.98);
}

#useCurrentLocationBtn {
    background-color: var(--surface-color-dark);
    color: var(--text-color-primary);
    margin-top: 10px; /* Separate from input slightly */
    border: 1px solid var(--border-color);
}

#useCurrentLocationBtn:hover {
    background-color: var(--hover-bg);
}


/* Overlay Header for Suggestions and Details */
.overlay-header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px 0;
    background-color: var(--surface-color-dark); /* Slightly darker for header */
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky; /* Sticky header */
    top: 0;
    z-index: 100;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color-primary);
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    border-radius: 50%; /* Make it round */
}

.icon-btn:hover {
    background-color: var(--hover-bg);
}

.icon-btn .material-icons {
    font-size: 24px;
}

#suggestionsSearchInput {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    background-color: var(--bg-color-dark);
    color: var(--text-color-primary);
    border-radius: 20px;
    font-size: 1.1em;
    margin: 0 10px;
    outline: none;
}

#suggestionsSearchInput::placeholder {
    color: var(--text-color-secondary);
}

/* Suggestions List */
.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    flex-grow: 1; /* Allow list to take available space */
}

.suggestions-list li {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 15px;
}

.suggestions-list li:last-child {
    border-bottom: none;
}

.suggestions-list li:hover {
    background-color: var(--hover-bg);
}

.suggestions-list li .material-icons {
    color: var(--text-color-secondary);
}

/* Route Summary Header (in Route Options & Details) */
.route-summary-header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px 0;
    background-color: var(--surface-color-dark);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.route-summary-text {
    flex-grow: 1;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding-right: 48px; /* To visually center it when back button is present */
}

.route-summary-text .arrow-icon {
    font-size: 1.2em;
    color: var(--text-color-secondary);
}

/* Route Options List */
.route-options-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    flex-grow: 1;
}

.route-options-list li {
    background-color: var(--surface-color-dark);
    margin-bottom: 10px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.route-options-list li:hover {
    background-color: var(--hover-bg);
}

.route-option-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.route-option-icons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap; /* Allow icons to wrap if many */
    flex-grow: 1;
}

.route-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--text-color-secondary); /* Default for walk */
    color: var(--bg-color-dark);
    font-size: 18px;
    font-weight: bold;
}

.route-mode-icon.transit {
    color: var(--text-color-primary); /* Text color for transit icons */
    /* Background color set dynamically by JS for transit lines */
}

.route-total-time {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    margin-left: auto; /* Pushes to the right */
}

.route-times {
    font-size: 0.9em;
    color: var(--text-color-secondary);
    display: flex;
    justify-content: space-between;
}

/* Map Container for Route Details */
.map-container {
    width: 100%;
    height: 300px; /* Fixed height for the map */
    background-color: var(--border-color); /* Placeholder color */
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden; /* Ensures map content stays within border-radius */
}

/* Route Steps List (in Route Details Popup) */
.route-steps-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    flex-grow: 1;
}

.route-steps-list li {
    background-color: var(--surface-color-dark);
    margin-bottom: 8px;
    padding: 12px 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px var(--shadow-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-steps-list li:hover {
    background-color: var(--hover-bg);
}

.route-steps-list li.active-step {
    background-color: var(--active-bg);
    border: 1px solid var(--primary-color);
}


.step-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--text-color-secondary); /* Default for walk */
    color: var(--bg-color-dark);
    font-size: 20px;
    flex-shrink: 0; /* Don't let it shrink */
}

.step-icon-container.transit {
    color: var(--text-color-primary); /* Text color for transit step icons */
    /* Background color set dynamically by JS for transit lines */
}

.step-details {
    flex-grow: 1;
}

.step-description {
    font-weight: bold;
    color: var(--text-color-primary);
}

.step-time {
    font-size: 0.9em;
    color: var(--text-color-secondary);
}

.loading-message, .error-message {
    padding: 20px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 1.1em;
}

.error-message {
    color: var(--error-color);
    font-weight: bold;
}

/* Make sure the scrollable content area uses all available height */
#suggestionsOverlay,
#routeOptionsScreen,
#routeDetailsPopup {
    height: 100vh; /* Ensure full viewport height */
    padding-bottom: 0; /* Remove padding from bottom to allow content to span full height if needed */
}

/* Adjust padding for scrollable content inside screens, not the screens themselves */
#suggestionsList,
#routeOptionsList,
#routeStepsList {
    padding-left: 20px;
    padding-right: 20px;
}

/* Fix for specific mobile layout issues (e.g., iPhone notch/safe areas) */
@supports(padding: max(0px)) {
    body {
        padding-top: constant(safe-area-inset-top);
        padding-top: env(safe-area-inset-top);
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: constant(safe-area-inset-left);
        padding-left: env(safe-area-inset-left);
        padding-right: constant(safe-area-inset-right);
        padding-right: env(safe-area-inset-right);
    }
    .screen {
        padding-top: calc(20px + constant(safe-area-inset-top));
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
    }
    /* Adjust fixed headers/footers for safe area */
    .overlay-header, .route-summary-header {
        padding-top: calc(10px + constant(safe-area-inset-top));
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}