/* Utility to hide elements */
.display-none {
    display: none !important;
}

:root {
    --primary-color: #0f172a;
    /* Darker, more minimal */
    --secondary-color: #334155;
    --accent-color: #10b981;
    --bg-glass: rgba(255, 255, 255, 0.6);
    /* More transparent */
    --border-glass: rgba(255, 255, 255, 0.4);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-main: #1e293b;
    --text-light: #64748b;
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    /* Inter Font */
    color: var(--text-main);
    overflow: hidden;
    margin: 0;
    /* Ensure no default margin */
    padding: 0;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    width: 100vw;
}

/* Hide Leaflet Routing Machine Container */
.leaflet-routing-container {
    display: none !important;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* --- Mobile Redesign Styles --- */

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Floating Map Controls (Bottom Right) */
.map-controls-container {
    position: absolute;
    top: auto;
    /* Reset top */
    bottom: 180px;
    /* Above the bottom card */
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    /* Above Map */
}

.btn-map-control {
    width: 44px;
    /* Larger touch target */
    height: 44px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    /* Subtle border */
    border-radius: 50%;
    /* Circular */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Nice shadow */
    color: var(--text-main);
    transition: var(--transition);
}

.btn-map-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-map-control:active {
    transform: scale(0.95);
}

/* Location States */
.btn-map-control.searching {
    color: #facc15;
    /* Yellow */
    border-color: #facc15;
    background: #fefce8;
    animation: pulse-yellow 2s infinite;
}

@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(250, 204, 21, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
    }
}

.btn-map-control.found {
    color: #10b981;
    /* Green */
    border-color: #10b981;
    background: white;
    /* Or keep white with green icon */
    background: #ecfdf5;
}

/* Specific styling for lock active state */
.btn-map-control.active-lock {
    color: #10b981;
    /* Green when locked */
    border-color: #10b981;
    background: #ecfdf5;
    /* Light green bg tint */
}



.btn-icon:hover {
    transform: translateY(-1px);
    background: white;
}

.btn-icon-small {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

/* Side Menu (Minimalist) */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    max-width: 80vw;
    background: rgba(255, 255, 255, 0.75);
    /* Highly semi-transparent */
    backdrop-filter: blur(20px);
    /* Strong blur */
    -webkit-backdrop-filter: blur(20px);
    z-index: 3000;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.05);
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    /* Smooth iOS-like */
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0;
    /* Flat edge */
}

.hidden-menu {
    transform: translateX(-100%);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border: none;
    padding: 0;
}

.menu-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    /* Inter Bold */
    margin: 0;
    letter-spacing: -0.02em;
}

/* Minimalist Inputs */
.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-wrapper {
    position: relative;
    margin-bottom: 24px;
}

select {
    width: 100%;
    padding: 14px 16px;
    /* Taller touch target */
    appearance: none;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
}

.select-wrapper i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-main);
    font-size: 1rem;
}

/* Minimalist Buttons */
.btn {
    border: none;
    padding: 14px;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
}

.btn i {
    font-size: 1.2rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    margin-bottom: 12px;
}

.btn-secondary:active {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(0.98);
}

.btn-electric {
    background: rgba(251, 191, 36, 0.15);
    /* Tint instead of solid */
    color: #d97706;
    /* Dark amber text */
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: none;
}

.menu-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    opacity: 0.6;
}

.full-width {
    width: 100%;
}

/* Compact Bottom Card */
.bottom-card {
    position: fixed;
    bottom: 24px;
    left: 20px;
    right: 20px;
    margin: 0 auto;
    max-width: 600px;
    padding: 16px 20px;
    z-index: 1000;
    background: rgba(16, 185, 129, 0.85);
    /* Slightly transparent green */
    backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.2);
    color: white;
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;

    /* iPhone X Safe Area */
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 14px;
    /* Reduced vertical padding */
    padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.bottom-card.results-hidden {
    transform: translateY(150%);
    opacity: 0;
    pointer-events: none;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Space between Info Row and Thermometer */
    width: 100%;
}

.card-top-row {
    display: flex;
    align-items: center;
    /* Vertical center button with text */
    justify-content: space-between;
    width: 100%;
}

.station-info {
    display: flex;
    flex-direction: column;
    gap: 0px;
    /* Tight text */
    flex-grow: 1;
    /* Take available space */
    padding-right: 10px;
}

.price-big {
    font-size: 1.4rem;
    /* Reduced from 1.7rem */
    font-weight: 800;
    /* Inter ExtraBold */
    line-height: 1;
    letter-spacing: -0.03em;
}

.price-container {
    display: flex;
    align-items: center;
    /* Center align big price with column */
    gap: 12px;
    margin-bottom: 4px;
}

.price-details-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
}

.fill-cost {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    opacity: 0.9;
    line-height: 1.1;
}



/* Minimal Input implementation */
.input-minimal {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    transition: var(--transition);
    margin-bottom: 24px;
}

.input-minimal:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
}

.station-details {
    display: flex;
    flex-direction: column;
}

.station-name {
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
    margin-bottom: 2px;
}

.details-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.route-info-text {
    font-size: 0.8rem;
    opacity: 0.8;
}

.savings-strong {
    font-weight: 800;
    /* Extra Bold */
    color: white;
    opacity: 1 !important;
    /* Force full visibility */
}

/* Price Thermometer */
.price-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    /* Closer to text */
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle separator */
}

.price-label {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.9;
    min-width: 36px;
    /* Slightly tighter */
    text-align: center;
}

.bar-track {
    flex-grow: 1;
    height: 6px;
    background: linear-gradient(90deg, #10b981 0%, #facc15 50%, #ef4444 100%);
    border-radius: 4px;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bar-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: left 0.3s ease;
}

.btn-nav-round {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    color: #10b981;
    border: none;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.btn-nav-round:hover {
    transform: scale(1.1);
}

.btn-nav-round:active {
    transform: scale(0.95);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    /* Lighter dim */
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.nav-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-btn {
    text-align: left;
    justify-content: flex-start;
    padding: 16px;
    font-size: 1rem;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: none;
}

.nav-btn i {
    margin-right: 12px;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.btn-text {
    background: none;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 500;
}

/* Toast */
.toast {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: var(--transition);
    opacity: 0;
    pointer-events: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    bottom: 100px;
    /* Higher up */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch Ripple Effect (Simplified) */
.ripple {
    position: relative;
    overflow: hidden;
}

/* Ensure hidden wins */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .btn-icon {
        top: 16px;
        left: 16px;
    }

    .bottom-card {
        left: 16px;
        right: 16px;
        bottom: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
        border-radius: 24px;
    }
}