
/* =========================================================
   WPMK - Matrikelkort
   Moderne kortlayout med flydende paneler
   ========================================================= */

:root {
    --wpmk-primary: #0073aa;
    --wpmk-primary-dark: #005f8d;
    --wpmk-success: #218838;
    --wpmk-text: #263238;
    --wpmk-muted: #64748b;
    --wpmk-border: #e2e8f0;
    --wpmk-panel-bg: rgba(255, 255, 255, 0.97);
    --wpmk-shadow: 0 8px 30px rgba(15, 23, 42, 0.14);
    --wpmk-radius: 14px;
}


/* =========================================================
   HOVEDCONTAINER
   ========================================================= */

.wpmk-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 700px;
    overflow: hidden;
    isolation: isolate;
    background: #e2e8f0;
    border-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif;
    color: var(--wpmk-text);
}

/*
 * MapLibre skal fylde hele containeren.
 */
#wpmk-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    z-index: 1;
}

/* Sørg for at MapLibre-canvas fylder kortet */
#wpmk-map .maplibregl-map,
#wpmk-map .maplibregl-canvas-container,
#wpmk-map canvas {
    width: 100%;
    height: 100%;
}


/* =========================================================
   GENERELLE PANELER
   ========================================================= */

.wpmk-panel {
    position: absolute;
    z-index: 20;
    box-sizing: border-box;
    background: var(--wpmk-panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--wpmk-radius);
    box-shadow: var(--wpmk-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 18px;
    max-width: calc(100% - 32px);
}

/* Brug denne klasse til paneler, der styres af dine kontroller */
.wpmk-panel.is-hidden {
    display: none !important;
}


/* =========================================================
   ADRESSESØGNING
   Altid synlig
   ========================================================= */

.wpmk-search-box {
    position: absolute;
    z-index: 30;
    top: 18px;
    left: 18px;
    right: 18px;

    display: flex;
    align-items: center;
    gap: 8px;

    max-width: 620px;
    padding: 8px;

    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    box-shadow: var(--wpmk-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#wpmk-adresse-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 44px;
    padding: 0 13px;

    border: 1px solid var(--wpmk-border);
    border-radius: 9px;
    background: #fff;
    color: var(--wpmk-text);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#wpmk-adresse-input::placeholder {
    color: #94a3b8;
}

#wpmk-adresse-input:focus {
    border-color: var(--wpmk-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

#wpmk-search-btn {
    flex-shrink: 0;
    height: 44px;
    padding: 0 18px;

    border: 0;
    border-radius: 9px;
    background: var(--wpmk-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

#wpmk-search-btn:hover {
    background: var(--wpmk-primary-dark);
}

#wpmk-search-btn:active {
    transform: scale(0.98);
}


/* =========================================================
   FEJLBESKED
   ========================================================= */

#wpmk-fejlbesked {
    position: absolute;
    z-index: 35;
    top: 88px;
    left: 18px;
    max-width: 600px;

    display: none;
    padding: 12px 15px;

    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(127, 29, 29, 0.1);
}


/* =========================================================
   MATRikel INFO
   ========================================================= */

#wpmk-info-panel {
    position: absolute;
    z-index: 20;
    top: 18px;
    left: 666px;

    display: none;
    max-width: min(440px, calc(100% - 36px));

    padding: 17px 19px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--wpmk-radius);
    background: var(--wpmk-panel-bg);
    box-shadow: var(--wpmk-shadow);
    color: var(--wpmk-text);
    font-size: 13px;
    line-height: 1.8;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#wpmk-info-panel strong {
    color: #475569;
    font-weight: 600;
}


/* =========================================================
   SOLFORHOLD PANEL
   ========================================================= */

#wpmk-sun-panel {
    position: absolute;
    z-index: 20;
    top: 18px;
    right: 60px;

    display: none;
    width: 360px;
    max-width: calc(100% - 36px);

    padding: 18px;
    margin: 0 !important;

    border: 1px solid #f5d77a;
    border-radius: var(--wpmk-radius);
    background: rgba(255, 251, 230, 0.97);
    box-shadow: var(--wpmk-shadow);
    color: #713f12;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#wpmk-sun-panel.is-visible {
    display: block;
}

#wpmk-sun-panel h4 {
    margin: 0;
    color: #92400e;
    font-size: 16px;
    font-weight: 700;
}

.wpmk-sun-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.wpmk-sun-header label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}

#wpmk-toggle-sun {
    accent-color: #d97706;
}

.wpmk-sun-fields {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.wpmk-sun-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.wpmk-sun-field {
    flex: 1;
    min-width: 140px;
}

.wpmk-sun-field label,
.wpmk-time-label {
    display: block;
    margin-bottom: 5px;
    color: #78350f;
    font-size: 12px;
    font-weight: 700;
}

#wpmk-sun-season {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #f1d58a;
    border-radius: 8px;
    background: #fff;
    color: #78350f;
    font-size: 13px;
}

#wpmk-sun-info {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px !important;
    margin-top: 0 !important;

    border: 1px solid #f1d58a !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #78350f;
    font-size: 12px;
    line-height: 1.8;
}

#wpmk-sun-info strong {
    font-weight: 700;
}

#wpmk-time-val {
    display: inline-block;
    padding: 3px 9px !important;

    border: 1px solid #fcd34d !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #b45309 !important;
    font-size: 14px !important;
    font-weight: 700;
}

#wpmk-sun-time-slider {
    width: 100%;
    margin: 5px 0 0;
    accent-color: #d97706;
    cursor: pointer;
}


/* =========================================================
   PLANTEGNINGSPANEL
   ========================================================= */

#wpmk-plantegning-panel {
    position: absolute;
    z-index: 20;
    top: 100px;
    left: 70px;

    display: none;
    width: 300px;
    max-width: calc(100% - 36px);
    max-height: calc(100% - 36px);
    overflow-y: auto;

    padding: 18px;
    margin: 0 !important;

    border: 1px solid #bce1ec;
    border-radius: var(--wpmk-radius);
    background: rgba(238, 247, 250, 0.97);
    box-shadow: var(--wpmk-shadow);
    color: var(--wpmk-text);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#wpmk-plantegning-panel h4 {
    margin: 0 0 16px;
    color: #075985;
    font-size: 17px;
    font-weight: 700;
}

#wpmk-plantegning-panel h5 {
    margin: 0;
    color: #075985;
    font-size: 14px;
    font-weight: 700;
}

.wpmk-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px;
}

.wpmk-form-group label,
.wpmk-form-row label {
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.wpmk-form-group small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
}

.wpmk-form-group input,
.wpmk-form-group select,
.wpmk-form-group textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;

    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wpmk-form-group input:focus,
.wpmk-form-group select:focus,
.wpmk-form-group textarea:focus {
    border-color: var(--wpmk-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wpmk-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
}

.wpmk-form-row label {
    flex: 1;
}

.wpmk-form-row input[type="number"] {
    width: 85px;
    min-height: 36px;
    padding: 6px 8px;
    box-sizing: border-box;

    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 13px;
}

.wpmk-form-row input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--wpmk-primary);
}

.wpmk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-height: 38px;
    padding: 8px 15px;

    border: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.wpmk-btn:active {
    transform: scale(0.98);
}

.wpmk-btn-primary {
    background: var(--wpmk-primary);
    color: #fff;
}

.wpmk-btn-primary:hover {
    background: var(--wpmk-primary-dark);
}

.wpmk-btn-success {
    background: var(--wpmk-success);
    color: #fff;
}

.wpmk-btn-success:hover {
    background: #1e7e34;
}

#wpmk-add-plan-btn {
    width: 100%;
    margin-top: 3px;
    padding: 11px 15px !important;
    background: var(--wpmk-success) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 9px !important;
    font-size: 13px;
    font-weight: 600;
}

#wpmk-add-plan-btn:hover {
    background: #1e7e34 !important;
}


/* =========================================================
   REDIGERING AF VALGT BYGNING
   ========================================================= */

#wpmk-edit-ctrl {
    display: none;
    flex-direction: column;
    gap: 12px;

    margin-top: 18px !important;
    padding-top: 17px !important;

    border-top: 1px dashed #a8d1df !important;
}

div#wpmk-building-list {
    max-height: 200px;
    overflow-y: scroll;
}

#wpmk-edit-ctrl.is-visible {
    display: flex !important;
}

#wpmk-active-title {
    font-weight: 700;
}

#wpmk-rotate-val {
    min-width: 42px;
    color: #075985;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

#wpmk-edit-hoejde,
#wpmk-edit-minhoejde {
    width: 85px !important;
    min-height: 36px;
    padding: 6px 8px;

    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 13px;
}




#wpmk-building-list-container{

    position: absolute;
    z-index: 20;
    top: 100px;
    left: 420px;
    display: none;
    max-width: min(440px, calc(100% - 36px));
    padding: 17px 19px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--wpmk-radius);
    background: var(--wpmk-panel-bg);
    box-shadow: var(--wpmk-shadow);
    color: var(--wpmk-text);
    font-size: 13px;
    line-height: 1.8;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

}



/* =========================================================
   MAPLIBRE KONTROLLER
   ========================================================= */

#wpmk-map .maplibregl-ctrl-top-left {
    top: 82px;
    left: 18px;
}

#wpmk-map .maplibregl-ctrl-group {
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.15);
}

#wpmk-map .maplibregl-ctrl-group button {
    width: 38px;
    height: 38px;
}

#wpmk-map .maplibregl-ctrl-group button + button {
    border-top: 1px solid #e2e8f0;
}


/* =========================================================
   RESPONSIVT DESIGN
   ========================================================= */

@media (max-width: 768px) {

    .wpmk-container {
        min-height: 600px;
        border-radius: 10px;
    }

    .wpmk-search-box {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 6px;
        border-radius: 11px;
    }

    #wpmk-adresse-input {
        height: 40px;
        font-size: 13px;
    }

    #wpmk-search-btn {
        height: 40px;
        padding: 0 12px;
        font-size: 12px;
    }

    #wpmk-map .maplibregl-ctrl-top-left {
        top: 70px;
        left: 10px;
    }

    #wpmk-sun-panel,
    #wpmk-plantegning-panel {
        top: 100px;
        left: 70px;
        right: 10px;
        width: auto;
        max-width: none;
        max-height: calc(100% - 20px);
        padding: 14px;
    }

    #wpmk-info-panel {
        top: 65px;
        left: 10px;
        right: 10px;
        max-width: none;
    }

    #wpmk-fejlbesked {
        top: 65px;
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .wpmk-sun-header {
        align-items: flex-start;
    }

    .wpmk-sun-row {
        flex-direction: column;
        align-items: stretch;
    }

    .wpmk-sun-field {
        min-width: 0;
    }
}

@media (max-width: 420px) {

    .wpmk-search-box {
        gap: 5px;
    }

    #wpmk-search-btn {
        padding: 0 10px;
    }

    .wpmk-form-row {
        gap: 8px;
    }

    .wpmk-form-row input[type="number"] {
        width: 70px;
    }
}
      
/**GAMMELT**/

        .wpmk-center-marker {
            width: 18px;
            height: 18px;
            background-color: #e74c3c;
            border: 2px solid #ffffff;
            border-radius: 50%;
            box-shadow: 0 0 6px rgba(0,0,0,0.4);
            cursor: grab;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 10px;
            font-weight: bold;
        }
        .wpmk-center-marker:active {
            cursor: grabbing;
            background-color: #c0392b;
        }
        .wpmk-center-marker.active-building {
            background-color: #27ae60; /* Grøn når valgt */
            transform: scale(1.2);
        }
        .wpmk-sun-marker {
            font-size: 22px;
            line-height: 22px;
            text-shadow: 0 0 3px #ffffff;
            user-select: none;
            transition: filter 0.3s ease;
        }
        .wpmk-building-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-bottom: 6px;
        }
        .wpmk-building-item.active {
            border-color: #27ae60;
            background-color: #f0fdf4;
        }

        .wpmk-center-marker.hide {
  display: none !important;
}




#wpmk-sun-panel,
#wpmk-building-list-container,
#wpmk-info-panel,
#wpmk-plantegning-panel {
 
    cursor: grab;
}

#wpmk-sun-panel:active,
#wpmk-building-list-container:active,
#wpmk-info-panel:active,
#wpmk-plantegning-panel:active {
    cursor: grabbing;
}
