/* Map Controls - Extensiones específicas de demo */

.map-controls {
    max-height: calc(100% - 40px);
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    backdrop-filter: blur(10px);
    min-width: 220px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.control-title {
    font-size: 0.9em;
    font-weight: 600;
    color: #2d5f4f;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group {
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.control-label {
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.map-controls select {
    transition: border-color 0.2s ease;
}

.map-controls select:focus {
    border-color: #0c461a;
    box-shadow: 0 0 0 3px rgba(12, 70, 26, 0.1);
}

.map-controls select:hover {
    border-color: #999;
}

#map {
    z-index: 1;
}

/* Collapsible Sections */
.collapsible-section {
    margin-top: 6px;
}

.collapsible-toggle {
    width: 100%;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7em;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.collapsible-toggle:hover {
    color: #0c461a;
    background: rgba(12, 70, 26, 0.03);
}

.toggle-label {
    flex: 1;
    text-align: left;
}

.toggle-icon {
    font-size: 0.7em;
    color: #999;
    transition: transform 0.2s ease;
}

.collapsible-content {
    display: none;
    padding: 8px 6px;
    margin-top: 2px;
}

/* PDF Link Styles */
.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7em;
    color: #0c461a;
    text-decoration: none;
    padding: 4px px;
    margin: 2px 0;
    border-radius: 3px;
    background: rgba(12, 70, 26, 0.05);
    transition: all 0.2s ease;
    font-weight: 500;
}

.pdf-link:hover {
    background: rgba(12, 70, 26, 0.15);
    color: #0c461a;
    text-decoration: none;
}

.pdf-link:active {
    transform: scale(0.98);
}
/* Hide Scenario 2 PDFs on load */
#scenario2 ~ .pdf-links-container {
    display: none;
}

/* Mobile adjustments for PDF links */
@media (max-width: 768px) {
    .pdf-link {
        font-size: 0.65em;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .pdf-link {
        font-size: 0.6em;
        padding: 2px 5px;
    }
}

/* Slider Control */
.slider-control {
    margin-top: 2px;
}

.slider-label {
    font-size: 0.65em;
    color: #666;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.opacity-value {
    color: #0c461a;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 2px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #0c461a;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0c461a;
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #0c461a;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0c461a;
    transform: scale(1.15);
}

/* Legend Styles */
.legend-content {
    padding: 0;
    line-height: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
}

.legend-color-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

/* Legend symbol for lines (pipes) */
.legend-symbol {
    width: 16px;
    height: 3px;
    flex-shrink: 0;
    border-radius: 1px;
}
.legend-dashed-line {
    display: inline-block;
    width: 15px;
    height: 3px;  /* stroke-width: 1 */
    background-image: linear-gradient(to right, #000000 60%, transparent 60%); 
    background-size: 6px 4px;  /* dash pattern: 6px dash + 4px gap = 10px total */


}
        

.legend-label {
    font-size: 0.7em;
    color: #333;
    font-weight: 400;
    line-height: 1.2;
}

/* Legend rectangle for buildings */
.legend-color-rectangle {
    width: 16px;
    height: 14px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 1px;
}

/* Legend diamond for points */
.legend-color-diamond {
    width: 12px;
    height: 12px;
    background-color: #0000ff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    transform: rotate(45deg);
}

/* Layer Checkboxes - Custom Style */
.layer-item {
    margin-bottom: 10px;
    padding: 6px;
    border-radius: 4px;
    background: #f9f9f9;
    position: relative;
}

/* Info Button */
.info-button {
    width: 13px;
    height: 13px;
    background: none !important;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 1px;
    line-height: 1;
    color: #3b9dd8;
    opacity: 0.7;
    margin-top: -7px;
}

.info-button:hover {
    opacity: 1;
    background: none !important;
}

.info-button:active {
    background: none !important;
}

.info-button:focus {
    outline: none;
    background: none !important;
}

/* Tooltip Styles - FIXED z-index to not overlap controls below */
.info-tooltip {
    display: none;
    position: relative; /* CHANGED from absolute to relative to allow scrolling */
    margin-top: 6px;
    z-index: 10;
}

.info-tooltip.active {
    display: block;
}

.tooltip-content {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
}

.tooltip-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: right;
    padding: 0;
    transition: color 0.2s ease;
}

.tooltip-close:hover {
    color: #333;
}

.tooltip-title {
    font-size: 0.75em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-right: 20px;
}

.tooltip-info {
    font-size: 0.7em;
    color: #555;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #f5f5f5;
    border-radius: 3px;
}

.tooltip-info p {
    margin: 0;
    line-height: 1.4;
}

.tooltip-content .pdf-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.layer-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    line-height: 1.2;
}

/* Hide the default checkbox */
.layer-checkbox input[type="checkbox"] {
    display: none;
}

/* Custom checkbox */
.custom-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid #3b9dd8;
    border-radius: 3px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Checkmark icon */
.custom-checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

/* When checked */
.layer-checkbox input[type="checkbox"]:checked + .custom-checkbox {
    background: #19a82c;
    border-color: #19a82c;
}

.layer-checkbox input[type="checkbox"]:checked + .custom-checkbox::after {
    opacity: 1;
    transform: scale(1);
}

/* Label text */
.layer-checkbox .checkbox-label {
    font-size: 0.8em;
    color: #333;
    user-select: none;
    flex: 1;
    font-weight: 500;
}

.layer-checkbox input[type="checkbox"]:checked ~ .checkbox-label {
    font-weight: 600;
    color: #2d5f4f;
}

.layer-opacity {
    padding-left: 0;
}

/* Base layer*/
.base-layer-info {
    position: absolute;
    bottom: 60px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
}

.base-layer-info.active {
    display: block;
}

/* Content Section */
.content-section {
    margin-top: 3em;
    padding: 2em;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #0c461a;
}

.content-section h3 {
    color: #2F4F4F;
    margin-bottom: 1em;
}

.content-section p {
    color: #666;
    line-height: 1.8;
}

.leaflet-control-zoom {
    position: absolute;
    bottom: 20px;
    left: 10px;
    top: auto;
    right: auto;
}

.leaflet-control-zoom a {
    background-color: rgba(253, 253, 253, 0.64);
    color: #0c461a;
    line-height: 10px;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(7, 29, 13, 0.2);
}

.leaflet-control-zoom a:first-child {
    border-bottom: 1px solid rgba(0,0,0,0.2);
    border-radius: 4px 4px 0 0;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 2px 2px;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 6px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #2d5f4f;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Responsive Design - Extensiones específicas */
@media (max-width: 1024px) {
    .map-wrapper {
        height: 500px;
    }
    article header h2 {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    #header h1 {
        margin-left: 1em;
        font-size: 1.2em;
    }
    #header nav {
        display: none;
    }
    .map-wrapper {
        height: 450px;
        margin: 1.5em 0;
    }
    
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hide map controls by default */
    .map-controls {
        top: 10px;
        right: -280px;
        min-width: 250px;
        max-width: 250px;
        padding: 10px;
        max-height: calc(100vh - 120px);
        font-size: 0.9em;
        transition: right 0.3s ease;
        box-shadow: -2px 0 8px rgba(0,0,0,0.3);
    }
    
    /* Show controls when active */
    .map-controls.active {
        right: 10px;
    }
    
    /* Add overlay when menu is open */
    .map-wrapper::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0);
        pointer-events: none;
        z-index: 999;
        transition: background 0.3s ease;
    }
    
    .map-wrapper.menu-open::before {
        background: rgba(0, 0, 0, 0.3);
        pointer-events: auto;
    }
    
    .control-title {
        font-size: 0.85em;
    }
    
    .control-label {
        font-size: 0.75em;
    }
    
    .checkbox-label {
        font-size: 0.75em !important;
    }
    
    /* Tooltip responsive styles */
    .info-button {
        width: 16px;
        height: 16px;
        font-size: 15px;
    }
    
    .tooltip-title {
        font-size: 0.7em;
    }
    
    .tooltip-info {
        font-size: 0.65em;
    }
    
    .collapsible-toggle {
        padding: 6px 8px;
        font-size: 0.65em;
    }
    
    .slider-label {
        font-size: 0.6em;
    }
    
    .legend-label {
        font-size: 0.65em;
    }
    
    input[type="range"] {
        height: 4px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }
    
    article header h2 {
        font-size: 1.75em;
    }
    article header p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .mobile-menu-toggle {
        top: 5px;
        right: 5px;
        width: 40px;
        height: 40px;
    }
    
    .mobile-menu-toggle span {
        width: 20px;
    }
    
    .map-wrapper {
        height: 400px;
        border-radius: 4px;
        margin: 0.5em 0;
    }
    
    .map-controls {
        top: 5px;
        right: -220px;
        min-width: 200px;
        max-width: 200px;
        padding: 8px;
        max-height: calc(100vh - 100px);
        font-size: 0.85em;
    }
    
    .map-controls.active {
        right: 5px;
    }
    
    .control-group {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .layer-item {
        margin-bottom: 8px;
        padding: 5px;
    }
    
    /* Tooltip responsive styles for small screens */
    .info-button {
        width: 16px;
        height: 16px;
        font-size: 14px;
        border-width: 1.5px;
    }
    
    .tooltip-content {
        padding: 8px;
    }
    
    .tooltip-title {
        font-size: 0.65em;
        margin-bottom: 6px;
    }
    
    .tooltip-info {
        font-size: 0.6em;
        padding: 5px;
    }
    
    .tooltip-close {
        width: 14px;
        height: 14px;
        font-size: 16px;
    }
    
    .control-title {
        font-size: 0.8em;
        margin-bottom: 8px;
    }
    
    .control-label {
        font-size: 0.7em;
        margin-bottom: 6px;
    }
    
    .checkbox-label {
        font-size: 0.7em !important;
        line-height: 1.3;
    }
    
    .custom-checkbox {
        width: 14px;
        height: 14px;
    }
    
    .collapsible-toggle {
        padding: 5px 6px;
        font-size: 0.6em;
    }
    
    .collapsible-content {
        padding: 6px 4px;
    }
    
    .slider-control {
        margin-top: 1px;
    }
    
    .slider-label {
        font-size: 0.55em;
        margin-bottom: 3px;
    }
    
    .legend-item {
        padding: 2px 0;
        gap: 4px;
    }
    
    .legend-label {
        font-size: 0.6em;
    }
    
    .legend-color-circle,
    .legend-color-diamond {
        width: 10px;
        height: 10px;
    }
    
    .legend-color-rectangle {
        width: 14px;
        height: 12px;
    }
    
    .legend-symbol {
        width: 14px;
        height: 2px;
    }
    
    input[type="range"] {
        height: 3px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }
    
    .base-layer-info {
        bottom: 50px;
        left: 5px;
        padding: 6px 10px;
        font-size: 10px;
    }
    
    /* Make Leaflet zoom controls larger for touch */
    .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 18px !important;
    }
    
    article header h2 {
        font-size: 1.5em;
    }
}

/* Landscape phone optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .map-wrapper {
        height: 350px;
    }
    
    .map-controls {
        max-height: calc(100vh - 80px);
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .map-controls {
        min-width: 180px;
        max-width: 180px;
        padding: 6px;
        font-size: 0.8em;
    }
    
    .map-controls.active {
        right: 5px;
    }
    
    .checkbox-label {
        font-size: 0.65em !important;
    }
    
    .legend-label {
        font-size: 0.55em;
    }
}