/**
 * Room gallery modal, shared by [roomcloud_rooms] and [roomcloud_results].
 *
 * Its own file so a page with the rooms carousel loads it without the results styles (#1079).
 */

/* ==========================================================================
   Room Gallery Modal
   ========================================================================== */

.wpr-room-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpr-room-gallery-modal[hidden] {
    display: none;
}

.wpr-room-gallery-modal:not([hidden]) {
    animation: wprModalFadeIn 0.3s ease;
}

/* Frosted-glass overlay â€“ page remains visible */
.wpr-room-gallery-modal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

/* Dialog â€“ inherits theme background and text color */
.wpr-room-gallery-modal__dialog {
    position: relative;
    z-index: 10001;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 860px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
    /* Theme provides background/color via inheritance */
    background-color: var(--wp--preset--color--background, #fff);
    color: inherit;
}

.wpr-room-gallery-modal__dialog--active {
    opacity: 1;
    transform: scale(1);
}

.wpr-room-gallery-modal__content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.wpr-room-gallery-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.wpr-room-gallery-modal__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

/* Close Button — see .wpr-modal__close for shared styles */

/* Body â€“ side-by-side: image left, info right */
.wpr-room-gallery-modal__body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0;
}

/* Carousel â€“ left column, fills available height */
.wpr-room-gallery-modal__carousel {
    flex: 1 1 60%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #000;
    min-width: 0;
}

.wpr-room-gallery-modal__image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* With 2+ photos, a click or tap on each half goes to the next/previous one (#1069). */
.wpr-room-gallery-modal__image-container--navigable {
    cursor: pointer;
    touch-action: manipulation; /* no double-tap zoom or click delay on mobile */
    -webkit-tap-highlight-color: transparent;
}

.wpr-room-gallery-modal__image-container--navigable .wpr-room-gallery-modal__image {
    -webkit-user-drag: none;
    user-select: none;
}

.wpr-room-gallery-modal__image {
    max-width: none;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.wpr-room-gallery-modal__image--is-loading {
    opacity: 0;
}

/* Loader overlay */
.wpr-room-gallery-modal__image-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.wpr-room-gallery-modal__image-loader[hidden] {
    display: none;
}

.wpr-room-gallery-modal__spinner {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wprSpinnerRotate 0.7s linear infinite;
}

@keyframes wprSpinnerRotate {
    to { transform: rotate(360deg); }
}

/* Slide animations */
.wpr-room-gallery-modal__image--slide-out-left {
    animation: wprSlideOutLeft 0.3s ease forwards;
}

.wpr-room-gallery-modal__image--slide-out-right {
    animation: wprSlideOutRight 0.3s ease forwards;
}

.wpr-room-gallery-modal__image--slide-in-left {
    animation: wprSlideInLeft 0.3s ease forwards;
}

.wpr-room-gallery-modal__image--slide-in-right {
    animation: wprSlideInRight 0.3s ease forwards;
}

@keyframes wprSlideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-80px); }
}

@keyframes wprSlideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(80px); }
}

@keyframes wprSlideInLeft {
    from { opacity: 0; transform: translateX(-80px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes wprSlideInRight {
    from { opacity: 0; transform: translateX(80px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes wprModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Nav arrows â€“ kept white-on-dark because they sit over the photo */
.wpr-room-gallery-modal__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.85);
    border: none;
    color: #111;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.75;
    z-index: 10;
}

.wpr-room-gallery-modal__nav:hover {
    background-color: #fff;
    transform: translateY(-50%) scale(1.08);
    opacity: 1;
}

.wpr-room-gallery-modal__nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
    opacity: 1;
}

.wpr-room-gallery-modal__nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.wpr-room-gallery-modal__nav:disabled:hover {
    background-color: rgba(255, 255, 255, 0.85);
    transform: translateY(-50%);
}

.wpr-room-gallery-modal__nav--prev {
    left: 1rem;
}

.wpr-room-gallery-modal__nav--next {
    right: 1rem;
}

/* Counter â€“ overlaid on the dark photo area, kept white */
.wpr-room-gallery-modal__counter {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    pointer-events: none;
}

/* ==========================================================================
   Info panel â€“ right column
   ========================================================================== */

.wpr-room-gallery-modal__info {
    flex: 0 0 38%;
    max-width: 380px;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    font-size: 0.95rem;
}

.wpr-room-gallery-modal__info[hidden] {
    display: none;
}

/* Meta (occupancy, surface, beds) */
.wpr-room-gallery-modal__info-meta[hidden] {
    display: none;
}

.wpr-room-gallery-modal__info-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}

.wpr-room-gallery-modal__info-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.wpr-room-gallery-modal__info-meta-item i {
    width: 1rem;
    text-align: center;
    opacity: 0.65;
}

/* Description */
.wpr-room-gallery-modal__info-description[hidden] {
    display: none;
}

.wpr-room-gallery-modal__info-description-text {
    margin: 0;
    line-height: 1.7;
    opacity: 0.9;
}

/* Services */
.wpr-room-gallery-modal__info-services[hidden] {
    display: none;
}

.wpr-room-gallery-modal__info-services-title {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
}

@media (max-width: 768px) {
    .wpr-room-gallery-modal__dialog {
        width: 96vw;
        height: 92vh;
        border-radius: 6px;
    }

    .wpr-room-gallery-modal__header {
        padding: 0.625rem 1rem;
    }

    .wpr-room-gallery-modal__title {
        font-size: 0.95rem;
    }

    /* Stack vertically on mobile */
    .wpr-room-gallery-modal__body {
        flex-direction: column;
        overflow-y: auto;
    }

    .wpr-room-gallery-modal__carousel {
        flex: 0 0 auto;
        height: 100vw;
        min-height: 200px;
    }

    .wpr-room-gallery-modal__info {
        flex: 0 0 auto;
        max-width: none;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }

    .wpr-room-gallery-modal__counter {
        bottom: 0.5rem;
    }

    .wpr-room-gallery-modal__nav {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.95rem;
    }

    .wpr-room-gallery-modal__nav--prev {
        left: 0.5rem;
    }

    .wpr-room-gallery-modal__nav--next {
        right: 0.5rem;
    }
}
