/* Basic reset and page setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevents scrollbars */
}

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

/* Make sure all text elements use this color by default */
h1, h2, h3, h4, h5, h6, p, span, div, label {
    color: #333333;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative; /* For absolute positioning of controls */
}

/* Header styling */
header {
    text-align: left;
    padding: 12px 20px;
    background-color: white;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center; /* This ensures vertical centering */
    max-width: 1400px;
    margin: 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-right: 8px; /* Reduced from 15px */
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: #4C88F7;
    margin-right: 0; /* Removed margin-right */
    stroke-width: 1.5;
    display: block;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1; /* Add this to improve vertical alignment */
}

/* Map styling */
#map {
    height: 100vh;
    width: 100%;
    z-index: 1; /* Below the controls */
}

/* Combined timeline and line count container */
.timeline-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: white;
    padding: 12px 20px;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 1000;
    width: auto;
}

/* Slider row */
.slider-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

#year-slider {
    width: 300px;
    margin-right: 15px;
    height: 6px;
    background: #e9e9e9;
    border-radius: 3px;
    cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4682B4;
    cursor: pointer;
}

#year-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4682B4;
    cursor: pointer;
    border: none;
}

#year-display {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    color: #333;

}

/* Line count styling */
.line-count {
    position: static;
    transform: none;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.9rem;
    color: #666;
    box-shadow: none;
    margin-top: 2px;
}

/* Legend styling */
.legend {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Line colors for different streetcar types */
.horse {
    background-color: #8B4513; /* Brown */
}

.steam {
    background-color: #000000; /* Black */
}

.cable {
    background-color: #4682B4; /* Steel Blue */
}

.electric {
    background-color: #228B22; /* Forest Green */
}

/* Custom toggle switch styling */
.layer-toggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    margin-right: 8px;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.layer-toggle:checked + .toggle-slider {
    background-color: #4682B4;
}

.layer-toggle:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.legend-item {
    position: relative;
    display: flex;
    align-items: center;
    margin: 10px 0;
    cursor: pointer;
}

.legend-item:hover {
    opacity: 0.8;
}

.legend-color {
    width: 25px;
    height: 4px;
    margin: 0 8px;
}

.legend-label {
    font-size: 0.9rem;
    color: #333;
}

/* Fixed selector for checked state */
input[type="checkbox"]:checked + .toggle-switch .toggle-slider {
    background-color: #4682B4;
}

input[type="checkbox"]:checked + .toggle-switch .toggle-slider:before {
    transform: translateX(16px);
}

/* Fix Leaflet attribution styling */
.leaflet-control-attribution {
    font-size: 7px !important;
    padding: 1px 3px !important;
    background: rgba(255, 255, 255, 0.5) !important;
    color: #888 !important;
    border-radius: 2px !important;
}

.leaflet-bottom.leaflet-right {
    bottom: 2px !important;
    right: 2px !important;
}

.leaflet-control-attribution a {
    color: #888 !important;
    text-decoration: none !important;
}

/* Popup styling */
.popup-content {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

.popup-content h3 {
    margin-bottom: 5px;
    font-size: 1.1rem;
    color: #333;
}

.popup-content p {
    margin: 3px 0;
}

/* Position zoom controls */
.leaflet-top.leaflet-left {
    top: auto !important;
    bottom: 20px !important;
    left: 20px !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
    margin: 0 !important;
    border-radius: 8px !important;
    background: white !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    border-radius: 0 !important;
}

/* Fix zoom button borders */
.leaflet-control-zoom-in {
    border-bottom: 1px solid #e0e0e0 !important;
    border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 8px 8px !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4 !important;
}

/* Ensure other controls don't conflict */
.leaflet-bottom.leaflet-left {
    bottom: 90px !important; /* Move this up to avoid conflict with zoom */
}

/* Responsive design */
@media (max-width: 768px) {
    .timeline-container {
        flex-direction: column;
        padding: 8px 12px;
        bottom: 70px;
        width: 80%;
    }
    
    #year-slider {
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .legend {
        bottom: 70px;
        right: 10px;
        padding: 8px;
        max-width: 40%;
    }
    
    .legend-item {
        margin: 4px 0;
    }
    
    header {
        padding: 8px 15px;
    }
    
    .logo {
        height: 28px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }

    .logo-icon {
        width: 24px;
        height: 24px;
    }
}