/* =========================================
   Info Popup - Side-tab & Modal
   ========================================= */

#info-popup-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#info-popup-container:not(.show) {
    pointer-events: none;
}

/* ─── Popup card ─── */

#info-popup {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1002;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

#info-popup.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* ─── Side-tab mode (desktop, enough left space) ─── */

.side-tab #info-popup {
    opacity: 0;
    transform: translateX(20px);
}

.side-tab #info-popup.show {
    opacity: 1;
    transform: translateX(0);
}

/* ─── Modal mode (mobile / narrow screens) ─── */

.modal #info-popup {
    top: 2%;
    left: 2%;
    width: 96%;
    height: 96%;
    max-width: 1200px;
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    opacity: 0;
}

.modal #info-popup.show {
    transform: scale(1);
    opacity: 1;
}

/* ─── Backdrop (modal mode only) ─── */

#info-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    display: none;
}

.modal #info-popup-backdrop {
    display: block;
}

#info-popup-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.side-tab #info-popup-backdrop {
    display: none !important;
}

/* ─── Connector (side-tab mode) ─── */

#info-popup-connector {
    position: fixed;
    background: #e9ecef;
    height: 2rem;
    z-index: 1003;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    border-radius: 0;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

#info-popup-connector.show {
    opacity: 1;
}

.side-tab #info-popup-connector {
    display: block;
}

.modal #info-popup-connector {
    display: none !important;
}

/* ─── Header ─── */

#info-popup-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--madne-dargl-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#info-popup-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 50px);
}

/* ─── Close button ─── */

#info-popup-close {
    background: white;
    border: none;
    border-radius: 8px;
    color: var(--madne-dargl-bg);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 4px 12px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

#info-popup-close:hover {
    background: #e9ecef;
    color: #357abd;
}

/* ─── Body (iframe container) ─── */

#info-popup-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

#info-popup-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ─── Mobile adjustments ─── */

@media (max-width: 600px) {
    .modal #info-popup {
        border-radius: 0;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: none;
    }

    #info-popup-header {
        padding: 10px 12px;
    }

    #info-popup-title {
        font-size: 0.9rem;
    }

    #info-popup-close {
        font-size: 1.3rem;
        padding: 4px 10px;
    }
}