/* multi-criteria-analysis/css/style.css */

:root { 
    --pzh-red: #E3001B; 
    --esri-blue: #007ac2; 
    --esri-hover: #f3f3f3; 
    --border-color: #e0e0e0; 
    --sidebar-width: 360px; 
}

body { 
    margin: 0; 
    padding: 0; 
    font-family: 'Avenir Next', 'Segoe UI', 'Roboto', sans-serif; 
    background: #fff; 
    height: 100vh; 
    display: flex; 
    overflow: hidden; 
}

/* Sidebar & Tabs */
#sidebar { 
    width: var(--sidebar-width); 
    background: white; 
    border-right: 1px solid #ccc; 
    display: flex; 
    flex-direction: column; 
    z-index: 100; 
    box-shadow: 2px 0 5px rgba(0,0,0,0.05); 
}

.sidebar-header { 
    padding: 20px 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 15px; 
    border-bottom: 1px solid transparent; 
    position: relative; 
}

.sidebar-logo { 
    height: 55px; 
    width: auto; 
    display: block; 
}

.app-title { 
    font-weight: 700; 
    font-size: 20px; 
    color: #333; 
    line-height: 1.3; 
}

.menu-icon { 
    position: absolute; 
    top: 20px; 
    right: 20px; 
    font-size: 18px; 
    color: #999; 
    cursor: pointer; 
}

.tabs { 
    display: flex; 
    border-bottom: 1px solid var(--border-color); 
    background: #fff; 
    margin-top: 5px; 
}

.tab { 
    padding: 8px 15px; 
    font-size: 13px; 
    color: #666; 
    cursor: pointer; 
    border-bottom: 3px solid transparent; 
    flex: 1; 
    text-align: center; 
}

.tab:hover { background: #f9f9f9; } 
.tab.active { 
    color: #333; 
    border-bottom: 3px solid var(--pzh-red); 
    font-weight: 600; 
    background: white; 
}

.sidebar-content { 
    display: none; 
    flex: 1; 
    overflow-y: auto; 
    padding: 0; 
} 

.sidebar-content.active { display: block; }

/* Source tabs (NGR / Klimaateffectatlas) */
#search-source-tabs {
    display: flex;
    padding: 7px 10px;
    gap: 5px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}
.src-tab {
    flex: 1;
    padding: 5px 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f0f0f0;
    cursor: pointer;
    color: #555;
    transition: all 0.15s;
}
.src-tab:hover { background: #e0eaf5; border-color: #007ac2; color: #007ac2; }
.src-tab.active { background: #007ac2; color: #fff; border-color: #007ac2; }
#tab-kea.active { background: #e65100; border-color: #e65100; }

/* Sidebar Search & Results */
.filter-bar {
    padding: 8px 15px; 
    border-bottom: 1px solid var(--border-color); 
    position: relative; 
}

.filter-input { 
    width: 100%; 
    padding: 6px 10px 6px 30px; 
    border: 1px solid #ccc; 
    border-radius: 0; 
    font-size: 12px; 
    box-sizing: border-box; 
    outline: none; 
}

.filter-icon { 
    position: absolute; 
    left: 25px; 
    top: 50%; 
    transform: translateY(-50%); 
    color: #aaa; 
    font-size: 12px; 
}

#search-results {
    max-height: 320px;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    background: #fff;
    display: none;
}

.kea-sticky-search {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 12px;
    background: #fff8f5;
    border-bottom: 2px solid #e65100;
}

.kea-search-label {
    font-size: 10px;
    font-weight: 700;
    color: #e65100;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.kea-search-label .fa {
    margin-right: 4px;
}

.kea-search-wrap {
    position: relative;
}

.kea-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #e65100;
    font-size: 12px;
    pointer-events: none;
}

.kea-search-input {
    width: 100%;
    padding: 8px 10px 8px 30px;
    border: 1.5px solid #e65100;
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
    background: #fff;
    color: #333;
}

.kea-search-input::placeholder {
    color: #bba;
}

.kea-search-input:focus {
    border-color: #bf360c;
    box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.15);
}

.kea-section-label {
    padding: 5px 15px 3px;
    font-size: 10px;
    font-weight: 700;
    color: #888;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.result-item { 
    padding: 10px 15px; 
    cursor: pointer; 
    border-bottom: 1px solid #f5f5f5; 
    font-size: 13px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.result-item:hover { background: #f0f8ff; }

/* Active Layers */
#active-wms-layers { 
    padding: 10px 15px; 
    border-bottom: 1px solid #eee; 
    background: #fafafa; 
    display: none; 
}

.active-wms-item { 
    background: white; 
    border: 1px solid #ddd; 
    padding: 5px 10px; 
    margin-bottom: 5px; 
    border-radius: 4px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 12px; 
}

/* Layer Tree & Controls */
#layer-tree { padding-top: 5px; }
.tree-item { font-size: 13px; color: #333; }

details > summary { 
    list-style: none; 
    padding: 8px 15px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

details > summary:hover { background: #f0f8ff; } 
details > summary::-webkit-details-marker { display: none; }

.toggle-arrow { 
    font-size: 10px; 
    color: #666; 
    width: 10px; 
    transition: transform 0.2s; 
} 

details[open] > summary .toggle-arrow { transform: rotate(90deg); }

.checkbox-icon { 
    color: var(--esri-blue); 
    font-size: 14px; 
    margin-right: 4px; 
} 

.checkbox-icon.unchecked { color: #ccc; }

.sub-level { 
    padding-left: 38px; 
    padding-right: 15px; 
    padding-bottom: 10px; 
}

.mca-control { margin-bottom: 12px; }

.mca-label { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 4px; 
    font-size: 12px; 
    color: #444; 
    align-items: center; 
}

input[type=range] { 
    width: 100%; 
    height: 4px; 
    background: #eee; 
    border-radius: 2px; 
    appearance: none; 
}

input[type=range]::-webkit-slider-thumb { 
    appearance: none; 
    width: 14px; 
    height: 14px; 
    background: var(--esri-blue); 
    border-radius: 50%; 
    cursor: pointer; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); 
}

/* Map UI */
#map-container { 
    flex: 1; 
    position: relative; 
    background: #e5e5e5; 
}

.measuring-cursor { cursor: crosshair !important; }

.top-toolbar { 
    position: absolute; 
    top: 15px; 
    left: 60px; 
    z-index: 10; 
    display: flex; 
    gap: 8px; 
}

.tool-pill { 
    background: white; 
    border: 1px solid #bbb; 
    border-radius: 4px; 
    padding: 6px 12px; 
    font-size: 12px; 
    font-weight: 600; 
    color: #444; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
}

.tool-pill:hover { background: #f9f9f9; color: var(--esri-blue); }

/* --- NEW: Floating Map Search Bar --- */
.address-search-wrapper {
    display: none; /* Controlled via JS */
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 380px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.search-pill-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 10px 18px;
    border: 1px solid #ddd;
}

.search-pill-icon {
    color: var(--esri-blue);
    margin-right: 12px;
    font-size: 16px;
}

.search-pill-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    font-family: inherit;
    color: #333;
}

.search-pill-close {
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
}

.search-pill-close:hover { color: #888; }

.address-results-dropdown {
    display: none;
    background: white;
    margin-top: 8px;
    border-radius: 12px;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #eee;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.address-results-dropdown .result-item {
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: background 0.2s;
}

.address-results-dropdown .result-item:hover { background: #f0f8ff; }
.address-results-dropdown .result-item:last-child { border-bottom: none; }

.address-results-dropdown .result-item i {
    margin-right: 12px;
    font-size: 12px;
    color: #888;
}
/* --- END SEARCH BAR --- */

.help-btn { 
    position: absolute; 
    top: 15px; 
    right: 15px; 
    z-index: 10; 
    width: 32px; 
    height: 32px; 
    background: white; 
    border: 1px solid #bbb; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    color: var(--esri-blue); 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    font-size: 16px; 
}

.zoom-controls { 
    position: absolute; 
    top: 15px; 
    left: 15px; 
    z-index: 10; 
    display: flex; 
    flex-direction: column; 
    gap: 5px; 
}

.zoom-btn { 
    width: 32px; 
    height: 32px; 
    background: white; 
    border: 1px solid #bbb; 
    border-radius: 4px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    color: #444; 
    font-size: 14px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
}

.zoom-btn:hover { background: #eee; } 
.zoom-btn.active { 
    background: var(--esri-blue); 
    color: white; 
    border-color: var(--esri-blue); 
}

.scale-bar { 
    position: absolute; 
    bottom: 15px; 
    left: 15px; 
    z-index: 10; 
    background: rgba(255,255,255,0.85); 
    border: 1px solid #999; 
    border-top: none; 
    height: 6px; 
    width: 100px; 
    font-size: 11px; 
    color: #222; 
    display: flex; 
    align-items: flex-end; 
    padding: 0 0px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); 
    transition: width 0.3s; 
}

.scale-text { 
    position: absolute; 
    bottom: 8px; 
    left: 50%; 
    transform: translateX(-50%); 
    white-space: nowrap; 
    font-weight: 600; 
} 

.scale-tick { 
    position: absolute; 
    bottom: 0; 
    width: 1px; 
    height: 6px; 
    background: #999; 
}

.coords-widget { 
    position: absolute; 
    bottom: 0; 
    right: 0; 
    z-index: 10; 
    background: rgba(255,255,255,0.9); 
    padding: 4px 10px; 
    border-top-left-radius: 6px; 
    font-size: 11px; 
    color: #555; 
    font-family: monospace; 
    border-top: 1px solid #ccc; 
    border-left: 1px solid #ccc; 
    pointer-events: none; 
}

.heatmap-legend { 
    position: absolute; 
    bottom: 25px; 
    right: 15px; 
    z-index: 10; 
    background: rgba(255, 255, 255, 0.95); 
    padding: 10px 12px; 
    border-radius: 6px; 
    border: 1px solid #ccc; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.15); 
    display: none; 
    flex-direction: column; 
    align-items: flex-start; 
    min-width: 120px; 
}

.heatmap-title { 
    font-size: 11px; 
    font-weight: 700; 
    color: #333; 
    margin-bottom: 6px; 
}

.gradient-bar { 
    width: 100%; 
    height: 14px; 
    background: linear-gradient(to right, rgb(65, 182, 196), rgb(127, 205, 187), rgb(199, 233, 180), rgb(237, 248, 177), rgb(253, 187, 132), rgb(227, 74, 51)); 
    border-radius: 3px; 
    border: 1px solid rgba(0,0,0,0.1); 
    margin-bottom: 4px; 
}

.legend-labels { 
    display: flex; 
    justify-content: space-between; 
    width: 100%; 
    font-size: 10px; 
    color: #666; 
    font-weight: 600; 
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px 32px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-weight: bold;
    z-index: 200;
    text-align: center;
    min-width: 200px;
}

.mca-spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--esri-blue, #007ac2);
    border-radius: 50%;
    animation: mca-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes mca-spin { to { transform: rotate(360deg); } }

/* Welcome Content */
#welcome-content { 
    padding: 20px; 
    color: #333; 
    line-height: 1.6; 
    font-size: 14px; 
}

#welcome-content h3 { 
    color: var(--esri-blue); 
    margin-top: 0; 
    font-size: 18px; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 10px; 
    margin-bottom: 15px; 
}

#welcome-content p { margin-bottom: 15px; }

.welcome-list { 
    margin: 0; 
    padding: 0 0 0 20px; 
    color: #555; 
}

.welcome-list li { margin-bottom: 8px; }

.start-btn { 
    display: block; 
    width: 100%; 
    padding: 12px; 
    background: var(--esri-blue); 
    color: white; 
    text-align: center; 
    border-radius: 4px; 
    text-decoration: none; 
    font-weight: 600; 
    cursor: pointer; 
    margin-top: 25px; 
    box-sizing:border-box; 
    transition: background 0.2s; 
}

.start-btn:hover { background: #006099; }


/* WMS Layer Controls */
.layer-controls { 
    display: flex; 
    gap: 10px; 
    margin-top: 4px; 
    font-size: 11px; 
}

.layer-btn { 
    cursor: pointer; 
    color: #007ac2; 
    background: none; 
    border: none; 
    padding: 0; 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 4px; 
}

.layer-btn:hover { 
    text-decoration: underline; 
    color: #005a8d; 
}

.layer-legend-img { 
    margin-top: 8px; 
    display: block; 
    max-width: 100%; 
    border: 1px solid #eee; 
    padding: 2px; 
    background: white; 
    border-radius: 4px; 
}

/* PRINT STYLES */
@media print {
    #sidebar { display: none !important; }
    .top-toolbar, .zoom-controls, .help-btn, .address-search-wrapper { display: none !important; }
    #map-container { width: 100vw !important; height: 100vh !important; position: fixed; top: 0; left: 0; }
    #container { width: 100% !important; height: 100% !important; }
    .scale-bar, .heatmap-legend, .coords-widget { display: flex !important; }
}