/* ── Layout wrapper ──────────────────────────────────────────────── */
.klinik-map-layout {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,.08);
    border: 1px solid #e8e8e8;
    background: #fff;
}
.klinik-map-right { flex-direction: row; }
.klinik-map-left  { flex-direction: row-reverse; }
.klinik-map-col    { flex: 1 1 0; min-width: 0; }
.klinik-map-canvas { width: 100%; display: block; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.klinik-map-sidebar {
    flex: 0 0 var(--km-sidebar-width, 320px);
    width: var(--km-sidebar-width, 320px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid #e8e8e8;
    overflow: hidden;
}
.klinik-map-left .klinik-map-sidebar {
    border-left: none;
    border-right: 1px solid #e8e8e8;
}

/* ── Søgeboks ────────────────────────────────────────────────────── */
.km-search-box {
    padding: 18px 16px 14px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.km-search-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--uk-global-color, #1a1a2e);
    margin: 0 0 10px;
}
.km-search-input.uk-input {
    background: #f8f8f8 !important;
    border-color: #e8e8e8 !important;
    border-radius: 8px !important;
    padding-left: 36px !important;
}
.km-search-input.uk-input:focus {
    background: #fff !important;
    border-color: var(--uk-global-primary-background, #1e87f0) !important;
}

/* ── Liste ───────────────────────────────────────────────────────── */
.km-list {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.km-list::-webkit-scrollbar       { width: 4px; }
.km-list::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 2px; }

/* ── Liste-item (accordion) ──────────────────────────────────────── */
.km-list-item {
    border-bottom: 1px solid #f0f0f0;
    border-left: 3px solid transparent;
    transition: border-left-color .15s;
}
.km-list-item:last-child { border-bottom: none; }
.km-list-item.km-active  {
    border-left-color: var(--km-accent, var(--uk-global-primary-background, #1e87f0));
}
.km-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background .15s;
    user-select: none;
}
.km-item-header:hover                  { background: #fafafa; }
.km-list-item.km-open .km-item-header  { background: #fff; }
.km-item-navn {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--uk-global-color, #1a1a2e);
    margin: 0;
    flex: 1;
}
.km-item-chevron {
    color: #aaa;
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform .2s ease;
    display: flex;
    align-items: center;
}
.km-list-item.km-open .km-item-chevron { transform: rotate(180deg); }
.km-item-body {
    display: none;
    padding: 0 16px 10px;
}
.km-list-item.km-open .km-item-body { display: block; }
.km-item-adresse {
    font-size: .875rem;
    color: var(--uk-global-muted-color, #666);
    margin: 0 0 8px;
    line-height: 1.4;
}
.km-item-btn   { display: inline-block; }
.km-list-empty {
    padding: 28px 16px;
    text-align: center;
    color: #bbb;
    font-size: .875rem;
}

/* ── Klinik Map popup — KUN vores egne popups via .km-popup klassen ── */
/* Alle regler er scopet til .km-popup så YOOtheme's map ikke påvirkes */

.km-popup-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}
.km-popup-body {
    padding: 20px;
}
.km-popup-navn {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--uk-global-color, #1a1a2e);
    margin: 0 0 2px;
    padding-right: 32px;
}
.km-popup-adresse {
    font-size: .8125rem;
    color: var(--uk-global-muted-color, #666);
    margin: 0 0 8px;
    line-height: 1.4;
}

/* Nulstil Leaflet's p-margin KUN i vores popup */
.km-popup p {
    margin: 0 0 10px;
}
.km-popup p:last-child {
    margin-bottom: 0;
}

/* Nulstil Leaflet's a-styling KUN i vores popup */
.km-popup a { text-decoration: none; }

/* Fullwidth knap */
.km-popup-knap.uk-width-1-1 {
    display: block;
    text-align: center;
    box-sizing: border-box;
}

/* Popup wrapper — KUN når vores km-popup er til stede inde i popup */
/* Bruger :has() selector — virker i alle moderne browsere */
.leaflet-popup-content-wrapper:has(.km-popup) {
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.12) !important;
    border: none !important;
    min-width: 220px;
    max-width: 280px;
}
.leaflet-popup-content-wrapper:has(.km-popup) .leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
}

/* ── Responsivt ──────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .klinik-map-layout  { flex-direction: column !important; }
    .klinik-map-sidebar {
        flex: none;
        width: 100% !important;
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid #e8e8e8;
        max-height: 380px;
    }
    .km-list { max-height: 280px; }
}

/* ── Google Maps InfoWindow popup ───────────────────────────────── */
/* Scoped KUN til .km-popup så YOOtheme's eget map ikke påvirkes */

/* Fast bredde på alle popups */
.km-popup {
    width: 260px;
    font-family: inherit;
}

@media (max-width: 767px) {
    .km-popup {
        width: calc(100vw - 80px);
        max-width: 260px;
    }
    .km-popup-img {
        display: none;
    }
}
.km-popup-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    margin: 0;
}
.km-popup-body {
    padding: 16px;
}
.km-popup-navn {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--uk-global-color, #1a1a2e);
    margin: 0 0 4px;
    padding-right: 32px;
}
.km-popup-adresse {
    font-size: .8125rem;
    color: var(--uk-global-muted-color, #666);
    margin: 0 0 10px;
    line-height: 1.4;
}
.km-popup p      { margin: 0 0 10px; }
.km-popup p:last-child { margin-bottom: 0; }
.km-popup a      { text-decoration: none; }
.km-popup-knap.uk-width-1-1 { display: block; text-align: center; box-sizing: border-box; }

/* Google Maps InfoWindow reset — KUN vores popup */
.gm-style-iw:has(.km-popup) {
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    max-width: none !important;
}
.gm-style-iw:has(.km-popup) .gm-style-iw-d {
    overflow: hidden !important;
    max-height: none !important;
}
.gm-style-iw:has(.km-popup) .gm-style-iw-chr {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
}
.gm-style-iw:has(.km-popup) button.gm-ui-hover-effect {
    top: 4px !important;
    right: 4px !important;
    background: rgba(255,255,255,0.9) !important;
    border-radius: 50% !important;
}
