/* ============================================================
   Interaktive Karte DCE – imap.css
   ============================================================ */

.imap {
    max-width: 1035px;
    margin: 0 auto;
    font-family: 'Glober', Arial, sans-serif;
    color: #5a5a5a;
}

/* ---- Textblock ---- */
.imap__header {
    margin-bottom: 1.2rem;
}

/* ---- Legende ---- */
.imap__legende {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 1rem;
}

.imap__legende-item {
    display: flex;
    align-items: center;
    gap: 10px;
    /*padding: 7px 12px 7px 10px;*/
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    background: transparent;
    width: fit-content;
    min-width: 280px;
}

.imap__legende-item:hover {
    /*background: rgba(0, 0, 0, 0.04);*/
}

.imap__legende-item:focus-visible {
/*    outline: 3px solid #FF6B00;
    outline-offset: 2px;*/
    background-color: #b9b9b9;
    color: #fff;
}

.imap__legende-item.is-active {
/*    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);*/
}

/* Badge (farbiges Label z.B. "C", "R") */
.imap__legende-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-weight: 800;
    /*font-size: 0.8rem;*/
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

/* Farbfläche (für Flächenanzeige wie Oberleitungsbereich) */
.imap__legende-flaeche {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    flex-shrink: 0;
    /*border: 2px dashed rgba(0, 0, 0, 0.3) !important;*/
    border: 1px dashed #FF00BB !important;
}

.imap__legende-label {
    /*font-size: 0.9rem;*/
    flex: 1;
}

/* Checkbox-Haken */
.imap__legende-check {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.imap__legende-item.is-active .imap__legende-check {
/*    background: #FF6B00;
    border-color: #FF6B00;*/
    background: #5a5a5a;
    border-color: #5a5a5a;
}

.imap__legende-check svg {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
}

.imap__legende-item.is-active .imap__legende-check svg {
    opacity: 1;
    transform: scale(1);
}

/* ---- Karten-Container ---- */
.imap__karte-wrap {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    cursor: zoom-in;
    line-height: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: block;
}

/*.imap__karte-wrap:focus-visible {
    outline: 3px solid #FF6B00;
    outline-offset: 3px;
}*/

/* Zoom-Icon unten rechts */
.imap__karte-wrap::after {
    content: '';
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background:
        rgba(0, 0, 0, 0.45)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3C/svg%3E")
        center / 20px no-repeat;
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.imap__karte-wrap:hover::after {
    opacity: 1;
}

/* Basiskarte */
.imap__karte-basis {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
}

/* Overlay-Bilder */
.imap__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    object-fit: cover;
}

.imap__overlay.is-visible {
    opacity: 1;
}

/* ============================================================
   Lightbox
   ============================================================ */

.imap-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.82);
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}

.imap-lightbox.is-active {
    display: flex;
    animation: imapLbFadeIn 0.2s ease forwards;
}

@keyframes imapLbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.imap-lightbox__inner {
    position: relative;
    width: 100%;
    max-width: 1035px;
    max-width: 1920px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    animation: imapLbScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    cursor: default;
    line-height: 0;
}

@keyframes imapLbScaleIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.imap-lightbox__basis {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
}

.imap-lightbox__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    object-fit: cover;
}

.imap-lightbox__overlay.is-visible {
    opacity: 1;
}

/* Schließen-Button */
.imap-lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    z-index: 2;
}

.imap-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.imap-lightbox__close:focus-visible {
    outline: 3px solid #FF6B00;
    outline-offset: 2px;
}

/* Aktive Layer-Info */
.imap-lightbox__info {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    padding: 16px 14px;
    border-radius: 5px;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .imap__titel {
        font-size: 1.25rem;
    }

    .imap__legende-item {
        min-width: 0;
        width: 100%;
        padding: 0;
    }

    .imap-lightbox {
        padding: 10px;
    }

    .imap-lightbox__info {
        font-size: 11px;
        bottom: 8px;
    }
}

html.accessibility {
    .imap__legende-item:focus {
        /*outline: 3px solid #yellow;*/
        outline: 2px solid #ffff00;
        /*outline-offset: 2px;*/
        /*border-radius: 3px;*/
        background-color: #575757;
        color: #fff;
    }
    .imap__karte-wrap:focus {
        outline: 6px solid #000;
        /*outline-offset: 3px;*/
    }
}