/* -----------------------------------------------------
   FULLSCREEN MODAL – PREMIUM VERSION
----------------------------------------------------- */

#pepos-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

#pepos-modal-overlay.pepos-visible {
    opacity: 1;
    pointer-events: auto;
}

/* MAIN MODAL BOX */
.pepos-modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    background: #111;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: row;
    gap: 25px;
    overflow: hidden;
}

/* LEFT SIDE IMAGE */
.pepos-modal-img-wrap {
    flex: 0 0 65%;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pepos-modal-img-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

#pepos-modal-image {
    display: block;
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0,0,0,0.4);
}

.pepos-modal-zoom {
    flex: 0 0 auto;
    padding-top: 12px;
}

#pepos-modal-zoom {
    width: 100%;
    max-width: 520px;
    display: block;
    margin: 0 auto;
}

/* RIGHT SIDE INFO */
.pepos-modal-info {
    flex: 1;
    color: #fff;
    font-size: 17px;
    overflow-y: auto;
    padding-right: 10px;
}

.pepos-modal-info h2 {
    margin-top: 0;
    font-size: 28px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

/* CLOSE BUTTON */
.pepos-modal-close {
    position: absolute;
    top: 18px;
    right: 22px;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    opacity: 0.8;
    transition: .2s;
}

.pepos-modal-close:hover {
    opacity: 1;
}

/* ARROWS (DESKTOP DEFAULT) */
.pepos-modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 60px;
    font-weight: bold;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    user-select: none;
    transition: .2s;
    padding: 20px;
}

.pepos-modal-arrow:hover {
    color: #fff;
}

.pepos-modal-arrow.left {
    left: 15px;
}

.pepos-modal-arrow.right {
    right: 15px;
}

/* -----------------------------------------------------
   MOBILE LAYOUT – FIXES:
   1) Info always visible (scroll)
   2) Arrows become buttons in their own row (no overlap)
----------------------------------------------------- */
@media (max-width: 900px) {

    /* Switch to GRID so we can place arrows in their own row */
    .pepos-modal-content {
        width: 92vw;
        height: 92vh;
        padding-bottom: 24px;

        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 16px;

        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-content: start;
    }

    .pepos-modal-img-wrap {
        grid-column: 1 / -1;
        height: auto;
        width: 100%;
    }

    .pepos-modal-img-viewport {
        max-height: 55vh;
        overflow: auto;
    }

    .pepos-modal-info {
        grid-column: 1 / -1;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    /* Arrows become normal grid items (no absolute overlay) */
    .pepos-modal-arrow {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;

        font-size: 40px;
        padding: 10px 14px;

        background: rgba(0,0,0,0.55);
        border: 1px solid rgba(255,255,255,0.18);
        border-radius: 12px;

        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: fit-content;
    }

    .pepos-modal-arrow.left {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
    }

    .pepos-modal-arrow.right {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
    }
}

/* MOBILE FIX FOR CLOSE BUTTON */
@media (max-width: 900px) {

    .pepos-modal-close {
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
        z-index: 10000000 !important;
        font-size: 42px !important;
        opacity: 1 !important;
    }

    /* Make sure modal doesn't cover the X */
    #pepos-modal-overlay {
        z-index: 999999 !important;
    }

    .pepos-modal-content {
        z-index: 999990 !important;
    }
}
