/* ============================================================
   WebGIS – Havvandsstigning Horsens
   style.css
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    background: #0f1923;
}

/* ============================================================
   KORT
   ============================================================ */

#map {
    flex: 1;
    height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

#sidebar {
    width: 300px;
    min-width: 300px;
    background: #1a2b3c;
    color: #dde8f0;
    display: flex;
    flex-direction: column;
    /*overflow-y: scroll;*/
    z-index: 1000;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.4);

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: #2d4a63 #0f1f2e;
}

/* Chrome / Edge / Safari */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: #0f1f2e;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #2d4a63;
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #3d6b8f;
}

/* ---- Header ---- */

#sidebar-header {
    padding: 22px 18px 16px;
    background: #0f1f2e;
    border-bottom: 2px solid #1e6091;
    flex-shrink: 0;
}

#header-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

#sidebar-header h1 {
    font-size: 17px;
    font-weight: 700;
    color: #7ecfff;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

#sidebar-header p {
    font-size: 14px;
    color: #7a99b2;
    margin-top: 4px;
}

/* ---- Sections ---- */

.section {
    padding: 16px 18px;
    border-bottom: 1px solid #243d52;
    flex-shrink: 0;
}

.section h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #5ba8d4;
    margin-bottom: 14px;
}

/* ============================================================
   SLIDER
   ============================================================ */

#slider-section {
    background: #162535;
}

#slider-container {
    padding: 0 2px;
}

#slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #5a7d96;
    margin-bottom: 8px;
}

#flood-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #1565c0, #42a5f5);
    outline: none;
    cursor: pointer;
}

#flood-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #42a5f5;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: border-color 0.15s, transform 0.1s;
}

#flood-slider::-webkit-slider-thumb:hover {
    border-color: #7ecfff;
    transform: scale(1.1);
}

#flood-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #42a5f5;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

#slider-value {
    text-align: center;
    margin-top: 12px;
    line-height: 1;
}

#slider-number {
    font-size: 36px;
    font-weight: 700;
    color: #7ecfff;
    letter-spacing: -1px;
}

#slider-unit {
    font-size: 18px;
    font-weight: 400;
    color: #5ba8d4;
    margin-left: 3px;
}

/* ============================================================
   LAG-KONTROL
   ============================================================ */

.layer-item {
    margin-bottom: 10px;
}

.layer-item:last-child {
    margin-bottom: 0;
}

.layer-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #c0d4e4;
    cursor: pointer;
    user-select: none;
}

.layer-item label:hover {
    color: #ffffff;
}

.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #42a5f5;
    flex-shrink: 0;
}

.legend-box {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-box.flood {
    background: rgba(33, 150, 243, 0.6);
    border: 1.5px solid #1565c0;
}

.legend-box.gummi {
    background: rgba(150, 0, 255, 0.85);
    border: 1.5px solid #6200aa;
}

.legend-box.threatened {
    background: #ef5350;
    border: 1.5px solid #b71c1c;
}

.legend-box.warning {
    background: #ffa726;
    border: 1.5px solid #e65100;
}

.legend-box.safe {
    background: #66bb6a;
    border: 1.5px solid #1b5e20;
}

.legend-box.unknown {
    background: #ccc;
    border: 1.5px solid #616161;
}

/* Skjul "Ingen data"-rækken — fjern/kommenter for at vise igen */
.layer-item:has(#layer-unknown) {
    display: none;
}

/* Runde legende-cirkler (SAVE) */
.legend-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    color: #000000;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.legend-circle.save-legend { background: #000000; color: #ffffff; }

/* ============================================================
   BYGNINGSINFO-PANEL
   ============================================================ */

#info-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 280px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #1a2b3c;
    color: #dde8f0;
    z-index: 1001;
    border-radius: 8px;
    border: 1px solid #243d52;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    padding: 16px 18px;

    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #2d4a63 #0f1923;
}

#info-panel::-webkit-scrollbar        { width: 5px; }
#info-panel::-webkit-scrollbar-track  { background: #0f1923; border-radius: 0 8px 8px 0; }
#info-panel::-webkit-scrollbar-thumb  { background: #2d4a63; border-radius: 3px; }

#info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

#info-header h3 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #5ba8d4;
    margin-bottom: 0;
}

#info-close {
    background: none;
    border: none;
    color: #5a7d96;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}

#info-close:hover {
    color: #dde8f0;
    background: rgba(255,255,255,0.08);
}

/* Status-badge */
.info-status {
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-threatened {
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid rgba(239, 83, 80, 0.5);
    color: #ff8a80;
}

.status-warning {
    background: rgba(255, 167, 38, 0.15);
    border: 1px solid rgba(255, 167, 38, 0.5);
    color: #ffcc80;
}

.status-safe {
    background: rgba(102, 187, 106, 0.15);
    border: 1px solid rgba(102, 187, 106, 0.5);
    color: #a5d6a7;
}

.status-unknown {
    background: rgba(158, 158, 158, 0.15);
    border: 1px solid rgba(158, 158, 158, 0.5);
    color: #bdbdbd;
}

/* Tabel med egenskaber */
.info-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.info-table td {
    padding: 5px 0;
    border-bottom: 1px solid #1e3448;
    vertical-align: top;
}

.info-table td:first-child {
    color: #6e94ae;
    width: 48%;
    padding-right: 8px;
}

.info-table td:last-child {
    color: #dde8f0;
    font-weight: 500;
}

/* BBR data */
.bbr-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #1e3448;
    font-size: 12px;
}

.bbr-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #5ba8d4;
    margin-bottom: 8px;
}

.bbr-adresse {
    color: #c0d4e4;
    line-height: 1.6;
    margin-bottom: 8px;
}

.bbr-loading {
    color: #5a7d96;
    font-style: italic;
    font-size: 12px;
}

/* ============================================================
   FOOTER
   ============================================================ */

#sidebar-footer {
    margin-top: auto;
    padding: 12px 18px;
    border-top: 1px solid #243d52;
    flex-shrink: 0;
}

#sidebar-footer p {
    font-size: 10px;
    color: #c0d4e4;
    line-height: 1.7;
}

/* ============================================================
   SAVE-MARKERS (HTML-markers på kortet)
   ============================================================ */

.save-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    cursor: default;
}

.save-marker-2 { background: #000000; }
.save-marker-7 { background: #000000; }

/* ============================================================
   SPLASH SCREEN
   ============================================================ */

#splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0d1b2a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    pointer-events: all;
}

#splash.splash-fade {
    opacity: 0;
    pointer-events: none;
}

#splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

#splash-logo {
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 4px 24px rgba(59,159,212,0.25));
    animation: splash-pulse 2.4s ease-in-out infinite;
}

@keyframes splash-pulse {
    0%, 100% { filter: drop-shadow(0 4px 24px rgba(59,159,212,0.20)); }
    50%       { filter: drop-shadow(0 4px 32px rgba(59,159,212,0.50)); }
}

#splash-title {
    margin: 0;
    color: #c0d4e4;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

#splash-bar-wrap {
    width: 240px;
    height: 3px;
    background: rgba(59,159,212,0.12);
    border-radius: 2px;
    overflow: hidden;
}

#splash-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1a5f8a, #3b9fd4);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#splash-status {
    margin: 0;
    font-size: 10px;
    color: #3d6080;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* ============================================================
   HJÆLP-KNAP OG OVERLAY
   ============================================================ */

.section h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #2d4a63;
    border: 1px solid #3d6b8f;
    color: #c0d4e4;
    font-size: 9px;
    font-weight: 700;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-transform: none;
    letter-spacing: 0;
}

.help-btn:hover,
.help-btn.active {
    background: #1e6091;
    color: #ffffff;
    border-color: #3b9fd4;
}

#help-overlay {
    position: fixed;
    left: 308px;
    width: 320px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #1a2b3c;
    color: #dde8f0;
    z-index: 998;
    border-radius: 8px;
    border: 1px solid #243d52;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: #2d4a63 #0f1923;
}

#help-overlay::-webkit-scrollbar        { width: 5px; }
#help-overlay::-webkit-scrollbar-track  { background: #0f1923; border-radius: 0 8px 8px 0; }
#help-overlay::-webkit-scrollbar-thumb  { background: #2d4a63; border-radius: 3px; }

#help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

#help-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #5ba8d4;
}

#help-close {
    background: none;
    border: none;
    color: #5a7d96;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}

#help-close:hover {
    color: #dde8f0;
    background: rgba(255,255,255,0.08);
}

#help-body {
    font-size: 14px;
    line-height: 1.65;
    color: #b0c8dc;
}

#help-body p {
    margin-bottom: 10px;
}

#help-body p:last-child {
    margin-bottom: 0;
}

#help-body strong {
    color: #dde8f0;
    font-weight: 600;
}

#help-body ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 10px;
}

#help-body ul li {
    padding: 5px 0;
    border-bottom: 1px solid #1e3448;
    padding-left: 10px;
    position: relative;
}

#help-body ul li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: #2d4a63;
}

#help-body ul li:last-child {
    border-bottom: none;
}

/* ============================================================
   MAPLIBRE OVERRIDES
   ============================================================ */

.maplibregl-ctrl-group {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    background: #1a2b3c !important;
}

.maplibregl-ctrl-group button {
    background-color: #1a2b3c !important;
    border-color: #243d52 !important;
}

.maplibregl-ctrl-group button:hover {
    background-color: #243d52 !important;
}

.maplibregl-ctrl-icon {
    filter: invert(70%) sepia(40%) saturate(400%) hue-rotate(180deg);
}

.maplibregl-ctrl-attrib {
    background: rgba(15, 25, 35, 0.75) !important;
    color: #5a7d96 !important;
    font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
    color: #5ba8d4 !important;
}

/* Normal musemarkør i kortet */
.maplibregl-canvas {
    cursor: default !important;
}

/* Målestok */
.maplibregl-ctrl-scale {
    background: rgba(15, 25, 35, 0.10) !important;
    border-color: #444 !important;
    border-top: none !important;
    color: #444 !important;
    font-size: 10px !important;
    font-weight: bold;
    padding: 1px 5px !important;
}
