/* ========================================================
   ファイル名: room-gallery.css
   機能: 客室ギャラリー ＆ 館内マップモーダル：完全統合版
   更新: インラインナビゲーション・ドットインジケーター追加
========================================================= */

/* --- 1. 客室一覧側の画像・スライド表示 --- */
.room-gallery {
    width: 100%;
    margin-bottom: 10px;
}

/* スライドとボタンを包むコンテナ */
.slide-container {
    position: relative;
    width: 100%;
    line-height: 0;
    overflow: hidden;
}

.room-gallery .slide {
    position: relative;
    padding: 0;
    margin: 0;
    list-style: none;
    cursor: pointer;
    line-height: 0;
    aspect-ratio: 3 / 2;
    background-color: #f5f5f5; 
}

.room-gallery .slide li {
    width: 100%;
    height: 100%;
}

.room-gallery .slide li:not(:first-child) {
    display: none;
}

.room-gallery .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    vertical-align: bottom;
}

.room-gallery .slide-container:hover .slide img {
    transform: scale(1.05);
}

/* --- 2. インライン・スライドナビゲーション --- */
.inline-prev, .inline-next {
    all: unset;
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: rgba(0, 0, 0, 0.3) !important;
    color: #fff !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    user-select: none;
}

.inline-prev { left: 0; border-radius: 0 4px 4px 0; }
.inline-next { right: 0; border-radius: 4px 0 0 4px; }

.inline-prev:hover, .inline-next:hover {
    background: rgba(0, 0, 0, 0.7) !important;
    color: #C49B6C !important;
}

/* --- 3. スライドインジケーター（ドット） --- */
.slide-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 15;
    pointer-events: none; /* 下の画像クリックを邪魔しない */
}

.slide-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: block;
}

.slide-dots span.active {
    background: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    border-color: #C49B6C;
}

/* 画像が1枚以下の場合はナビとドットを非表示にする */
.slide-container:has(.slide li:only-child) .inline-prev,
.slide-container:has(.slide li:only-child) .inline-next,
.slide-container:has(.slide li:only-child) .slide-dots {
    display: none;
}

/* --- 4. サムネイル表示 --- */
.room-gallery .thumb {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0;
    margin: 10px 0 0 0;
    list-style: none;
}

.room-gallery .thumb li {
    flex: 0 1 calc(25% - 6px);
    max-width: 80px;
    min-width: 50px;
}

.room-gallery .thumb li:only-child {
    display: none;
}

.room-gallery .thumb img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    cursor: pointer;
    filter: grayscale(30%);
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.room-gallery .thumb img:hover {
    filter: grayscale(0);
    border-bottom: 2px solid #C49B6C;
}

/* --- 5. モーダル共通ベース --- */
#gallery-modal-overlay,
#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.98);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}

#modal-overlay {
    z-index: 200000;
}

/* --- 6. モーダルコンテンツ --- */
.modal-content {
    position: relative;
    width: 90%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

#modal-image,
#modal-overlay img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- 7. モーダル用ナビゲーション --- */
#gallery-modal-overlay .prev,
#gallery-modal-overlay .next {
    all: unset;
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 100px;
    color: #ffffff !important;
    background: transparent !important;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 40px;
    font-family: serif;
    transition: all 0.3s;
    user-select: none;
    z-index: 101;
    border: none !important;
    outline: none !important;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
}

#gallery-modal-overlay .prev:hover,
#gallery-modal-overlay .next:hover {
    color: #C49B6C !important;
}

#gallery-modal-overlay .prev { left: -80px; }
#gallery-modal-overlay .next { right: -80px; }

/* 閉じるボタン */
.modal-close {
    all: unset;
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: -60px;
    right: 0;
    color: #fff !important;
    font-size: 50px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s;
    font-weight: 200;
    background: transparent !important;
}

.modal-close:hover {
    color: #C49B6C !important;
    transform: rotate(90deg);
}

/* --- 8. モーダル内サムネイルエリア --- */
#modal-thumbnails {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    width: 100%;
    padding-bottom: 10px;
}

.thumbnail-item {
    width: 80px;
    height: 55px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.4s;
    border: 1px solid rgba(255,255,255,0.2);
}

.thumbnail-item.active {
    opacity: 1;
    border-color: #C49B6C;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(196, 155, 108, 0.5);
}

/* --- 9. レスポンシブ --- */
@media screen and (max-width: 1200px) {
    #gallery-modal-overlay .prev { left: 0; }
    #gallery-modal-overlay .next { right: 0; }
    #gallery-modal-overlay .prev,
    #gallery-modal-overlay .next {
        background: rgba(0, 0, 0, 0.2) !important;
        width: 50px;
    }
}

@media screen and (max-width: 768px) {
    .modal-content { width: 95%; }
    #modal-image, #modal-overlay img { max-height: 60vh; }
    .modal-close { top: -55px; right: 10px; font-size: 40px; }
    #modal-thumbnails { gap: 8px; }
    .thumbnail-item { width: 60px; height: 45px; }
    
    .inline-prev, .inline-next {
        width: 30px;
        height: 50px;
        font-size: 20px;
    }
    
    .slide-dots { bottom: 10px; gap: 6px; }
    .slide-dots span { width: 8px; height: 8px; }
}