/* ==========================================================================
   Stay Mystic - Room Gallery Lightbox
   Child theme: wprentals-child
   Loaded only on single estate_property pages that have room_galleries data.
   All classes are namespaced .smrg- to avoid colliding with the parent theme.
   ========================================================================== */

/* --- Modal shell --------------------------------------------------------- */
.smrg-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 999999;
    display: none;
    flex-direction: column;
    background: #ffffff;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.smrg-modal.is-open {
    display: flex;
}

body.smrg-scroll-lock {
    overflow: hidden !important;
}

/* --- Header: title, close, filter tabs ----------------------------------- */
.smrg-header {
    flex: 0 0 auto;
    background: #ffffff;
    border-bottom: 1px solid #ececec;
    padding: 14px 24px 0;
}

.smrg-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.smrg-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smrg-count {
    font-weight: 400;
    color: #757575;
    margin-left: 8px;
    font-size: 14px;
}

.smrg-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #1a1a1a;
    cursor: pointer;
    padding: 0;
    transition: background .18s ease;
}

.smrg-close:hover,
.smrg-close:focus {
    background: #f1f1f1;
    outline: none;
}

.smrg-close svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* --- Filter tabs --------------------------------------------------------- */
.smrg-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.smrg-tabs::-webkit-scrollbar {
    display: none;
}

.smrg-tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid #dcdcdc;
    border-radius: 999px;
    background: #ffffff;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.smrg-tab:hover {
    border-color: #9a9a9a;
}

.smrg-tab.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #ffffff;
}

.smrg-tab-count {
    opacity: .6;
    margin-left: 6px;
    font-size: 12px;
}

/* --- Scrollable photo area ----------------------------------------------- */
.smrg-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px;
}

.smrg-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.smrg-section + .smrg-section {
    margin-top: 36px;
}

.smrg-section[hidden] {
    display: none;
}

.smrg-section-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: .01em;
}

.smrg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.smrg-item {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: #f3f3f3;
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    line-height: 0;
}

.smrg-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    transition: transform .3s ease;
}

.smrg-item:hover img {
    transform: scale(1.03);
}

/* --- Single photo viewer ------------------------------------------------- */
.smrg-viewer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .94);
    padding: 40px 64px;
}

.smrg-viewer.is-open {
    display: flex;
}

.smrg-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.smrg-viewer-close,
.smrg-viewer-nav {
    position: absolute;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    transition: background .18s ease;
}

.smrg-viewer-close:hover,
.smrg-viewer-nav:hover {
    background: rgba(255, 255, 255, .28);
}

.smrg-viewer-close {
    top: 18px;
    right: 18px;
}

.smrg-viewer-nav--prev {
    left: 14px;
}

.smrg-viewer-nav--next {
    right: 14px;
}

.smrg-viewer-close svg,
.smrg-viewer-nav svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.smrg-viewer-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
    letter-spacing: .04em;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1024px) {
    .smrg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .smrg-header {
        padding: 10px 16px 0;
    }

    .smrg-title {
        font-size: 15px;
    }

    .smrg-tabs {
        padding: 12px 0;
        gap: 6px;
    }

    .smrg-tab {
        padding: 7px 14px;
        font-size: 13px;
    }

    .smrg-body {
        padding: 16px;
    }

    .smrg-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .smrg-section + .smrg-section {
        margin-top: 28px;
    }

    .smrg-viewer {
        padding: 56px 12px;
    }

    .smrg-viewer-nav {
        bottom: 16px;
        top: auto;
    }

    .smrg-viewer-nav--prev {
        left: 24%;
    }

    .smrg-viewer-nav--next {
        right: 24%;
    }

    .smrg-viewer-counter {
        bottom: 72px;
    }
}
