html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
}

.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background-color: #f8f9fa;
    padding: 0 15px;
    border-bottom: 1px solid #dee2e6;
    justify-content: space-between;
}

.header-options {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between the selectors */
    margin-left: auto; /* Push to the right */
}

.header h1 {
    margin-right: auto;
    font-size: 24px;
    color: #343a40;
}

.banner-container {
    margin-right: auto;
    position: relative;
}

.banner-image {
    max-height: 50px;
    width: auto;
    display: block;
}

.banner-image:not([src=""]) + .fallback-title {
    display: none;
}

.fallback-title {
    margin: 0;
    display: block;
}

.header-info {
    font-size: 14px;
    color: #6c757d;
}

#map {
    flex: 1;
    width: 100%;
    min-height: 300px; /* Fallback minimum height */
}

.footer {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-top: 1px solid #dee2e6;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

.footer {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
}

.footer-content {
    text-align: center;
    /* Ensure the centered text stays centered regardless of the button */
    flex-grow: 1;
}

.footer-info-button {
    position: absolute;
    right: 20px;
    background: none;
    border: 1px solid #666;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.footer-info-button:hover {
    background: #f0f0f0;
    border-color: #333;
}

.footer-info-button svg {
    width: 16px;
    height: 16px;
}

.info {
    padding: 8px 10px;
    font: 14px/16px Arial, Helvetica, sans-serif;
    background: white;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    width: 300px;
}

.info h4 {
    margin: 0 0 5px;
    color: #555;
    font-size: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.frequency-table {
    border-collapse: collapse;
    width: 100%;
    margin: 5px 0;
}

.frequency-table th,
.frequency-table td {
    border: 1px solid #ddd;
    padding: 2px;
    text-align: center;
    font-size: 0.8em;
}

.legend {
    text-align: left;
    line-height: 18px;
    color: #555;
    width: 200px;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.legend-section {
    margin-bottom: 15px;
}

#current-layer {
    font-weight: bold;
    margin-bottom: 5px;
}

.layer-info {
    font-size: 12px;
    font-style: italic;
    margin-bottom: 10px;
}

.layer-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}

/* Add styles for checkbox container */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    margin-left: 10px;
    width: 100%;
    justify-content: flex-start;
}

/* Style the checkbox input */
.quality-row .quality-btn input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.quality-checkboxes {
    margin-top: 8px;
}

.quality-checkboxes .checkbox-row {
    margin: 4px 0;
    display: flex;
    align-items: center;
}

.quality-checkboxes input[type="checkbox"] {
    margin-right: 8px;
}

.quality-checkboxes label {
    user-select: none;
}

.quality-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0;
}

.quality-row {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
}

.quality-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 28px;
    padding: 2px 8px;
    border-radius: 14px;
    background-color: #f0f0f0;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.quality-btn span {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: color 0.2s ease;
}

/* Active state */
.quality-btn.active {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.quality-btn.active span {
    color: #2196f3;
}

/* Hover state */
.quality-btn:hover:not(.active) {
    background-color: #e9e9e9;
}

/* Quality-specific colors */
.quality-btn.quality-A.active {
    background-color: #e8f5e9;
    border-color: #4caf50;
}

.quality-btn.quality-A.active span {
    color: #4caf50;
}

.quality-btn.quality-B.active {
    background-color: #f1f8e9;
    border-color: #8bc34a;
}

.quality-btn.quality-B.active span {
    color: #8bc34a;
}

.quality-btn.quality-C.active {
    background-color: #fffde7;
    border-color: #fbc02d;
}

.quality-btn.quality-C.active span {
    color: #fbc02d;
}

.quality-btn.quality-D.active {
    background-color: #fff3e0;
    border-color: #ff9800;
}

.quality-btn.quality-D.active span {
    color: #ff9800;
}

.quality-btn.quality-E.active {
    background-color: #fbe9e7;
    border-color: #ff5722;
}

.quality-btn.quality-E.active span {
    color: #ff5722;
}

.quality-btn.quality-F.active {
    background-color: #ffebee;
    border-color: #f44336;
}

.quality-btn.quality-F.active span {
    color: #f44336;
}

.quality-btn.quality-none {
    flex: 2;  /* Make it take twice the space */
    min-width: 72px;  /* Twice the min-width of regular buttons + gap */
}

.quality-btn.quality-none.active {
    background-color: #f5f5f5;
    border-color: #9e9e9e;
}

.quality-btn.quality-none.active span {
    color: #9e9e9e;
}

.legend-comparison {
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-item i {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    opacity: 0.7;
    border: 1px solid #999;
}

.groups-info {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
}

.group-item {
    font-size: 0.9em;
    line-height: 1.4;
}

.group-label {
    font-weight: bold;
    margin-right: 5px;
}

.group-name {
    font-style: italic;
}

/* Style the label */
.checkbox-row label {
    text-align: left;
    padding-left: 0;
    margin-left: 0;
    flex-grow: 1;
    white-space: normal;
    word-break: break-word;
}

.layer-control {
    padding: 8px 10px;
    background: white;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    width: 300px;
}

.layer-control h4 {
    margin: 0 0 5px;
    color: #555;
    font-size: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.layer-button {
    margin: 2px;
    padding: 5px 10px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.layer-button:hover {
    background: #e6e6e6;
}

.layer-button.active {
    background: #4d7ec8;
    color: white;
    font-weight: bold;
    border-color: #3866a3;
}

/* Style for the toggle checkbox container */
.toggle-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

/* Style for the toggle checkbox */
#toggle-stops {
    margin-right: 5px;
    cursor: pointer;
}

/* Style for the toggle label */
label[for="toggle-stops"] {
    cursor: pointer;
    font-size: 14px;
}

/* SVG path elements in stop areas need pointer-events to capture mouse events */
.stop-area path {
    pointer-events: visiblePainted !important;
}

.slider-control {
    padding: 10px;
    margin-bottom: 10px;
}

.slider-control input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

.slider-control #slider-value {
    display: inline-block;
    margin-left: 5px;
}

.marker-cluster-low {
    background-color: rgba(255, 0, 0, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(255, 165, 0, 0.6);
}

.marker-cluster-high {
    background-color: rgba(0, 255, 0, 0.6);
}

.marker-cluster div {
    background-color: rgba(255, 255, 255, 0.8);
}

.layer-row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-bottom: 5px;
    gap: 5px;
}

.layer-button {
    flex-grow: 1;
    margin: 3px 0;
    padding: 5px 10px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    height: 100%;
}

.layer-button:hover {
    background: #e6e6e6;
}

.layer-button.active {
    background: #4d7ec8;
    color: white;
    font-weight: bold;
    border-color: #3866a3;
}

.download-button {
    padding: 5px 10px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    margin: 2px 0;
    min-width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.download-button:hover {
    background: #e6e6e6;
}

.loading-indicator {
    padding: 6px 8px;
    background: white;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    font-weight: bold;
}

.loading-indicator.hidden {
    display: none;
}

.layer-group-selector {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

.layer-group-selector select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    cursor: pointer;
}

.layer-group-selector select:hover {
    background-color: #f0f8ff;
    border-color: #4d7ec8;
}

.layer-group-selector select:focus {
    outline: none;
    border-color: #3866a3;
    box-shadow: 0 0 4px rgba(77, 126, 200, 0.5);
}

/* Styles for difference visualization */
.difference-improved {
    background: rgba(76, 175, 80, 0.7);  /* Green with transparency */
}

.difference-declined {
    background: rgba(244, 67, 54, 0.7);  /* Red with transparency */
}

.difference-unchanged {
    background: rgba(158, 158, 158, 0.4);  /* Grey with transparency */
}

.difference-na {
    background: rgba(0, 0, 0, 0.1);  /* Very light grey for N/A */
}

.header-options {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.layer-group-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style for both selects */
.layer-group-selector select {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background-color: white;
    font-size: 14px;
    min-width: 200px;
    cursor: pointer;
}

/* Comparison controls container */
.comparison-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle comparison button */
#toggle-comparison {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#toggle-comparison:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

#toggle-comparison.active {
    background-color: #4d7ec8;
    color: white;
    border-color: #3866a3;
}

/* Hover effects for selects */
.layer-group-selector select:hover {
    border-color: #4d7ec8;
}

.layer-group-selector select:focus {
    outline: none;
    border-color: #4d7ec8;
    box-shadow: 0 0 0 2px rgba(77, 126, 200, 0.25);
}

/* Comparison mode specific styles */
.comparison-mode .layer-group-selector {
    background: rgba(77, 126, 200, 0.1);
    padding: 10px;
    border-radius: 4px;
}

/* Popupinfo mode specific styles */

.footer-info-button {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
    height: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.footer-info-button:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.info-button-icon {
    font-size: 16px;
    display: inline-block;
}

.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.info-popup {
    background: white;
    width: 50%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 24px;
    position: relative;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    margin-bottom: 60px;
}

.info-popup.active {
    opacity: 1;
    transform: translateY(0);
}

.info-popup-overlay.active {
    opacity: 1;
}

.info-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.info-popup-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.info-popup-content {
    margin-top: 20px;
}

.info-popup-image {
    width: 100%;
    margin: 16px 0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-popup-image-caption {
    text-align: center;
    color: #666;
    margin-bottom: 16px;
    font-style: italic;
}

@media (max-width: 768px) {
    .info-popup {
        width: 90%;
        margin-bottom: 40px;
        max-height: 75vh;
    }
}

.legend-population {
    line-height: 18px;
    color: #555;
}

.legend-population i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.legend-item {
    margin-bottom: 5px;
    clear: both;
}

.population-control {
    background: white;
    padding: 6px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

.population-button {
    display: block;
    margin: 2px 0;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.population-button:hover {
    background: #f4f4f4;
}

.population-button.active {
    background: #4a90e2;
    color: white;
    border-color: #357abd;
}

