.house-detail-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    font-family: sans-serif;
}

.house-detail-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 40px;
    align-items: flex-start;
}

.house-gallery {
    flex: 1 1 60%;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.carousel-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

.carousel-image.active {
    opacity: 1;
    z-index: 1;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    border: none;
    font-size: 18px;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: background 0.3s;
    color: #333;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(255, 255, 255, 0.9);
}

.carousel-prev:focus,
.carousel-next:focus {
    outline: none;
    box-shadow: none;
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 11;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
}

.dot.active {
    background: #fff;
    transform: scale(1.3);
}

.house-info {
    flex: 1 1 35%;
}

.house-info p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.5;
}

/* ➕ 美化房源條列資料 */
.house-brief {
    font-size: 16px;
    line-height: 1.8;
    color: #222;
}

.brief-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    align-items: baseline;
}

.house-title {
    font-size: 1.4rem;     /* 字體再大一些 */
    font-weight: 900;      /* 更粗 */
    margin-left: 50px;     /* 左邊間距 */
    margin-bottom: 15px;   /* 與編號的間距 */
}

/* 租金格式專用 */
.rent-display {
    display: inline-flex;
    align-items: baseline;
    gap: 6px; /* 元素之間留一點距離 */
}

.rent-value {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.rent-display .currency {
    font-size: 12px;
    font-weight: 400;
    color: #555;
}

.rent-display .amount {
    font-size: 20px;   /* 數字放大 */
    font-weight: 700;  /* 加粗 */
    color: #111;
}

.rent-display .per {
    font-size: 12px;
    font-weight: 400;
    color: #555;
}

/* 車位租金格式專用 */
.rent-car-display {
    display: flex;
    align-items: baseline;
    gap: 6px; /* 元素之間留一點距離 */
}

.rent-car-display .currency {
    font-size: 10px;
    font-weight: 400;
    color: #555;
}

.rent-car-display .amount {
    font-size: 14px;   /* 數字放大 */
    font-weight: 400;  /* 加粗 */
    color: #111;
}

.rent-car-display .per {
    font-size: 10px;
    font-weight: 400;
    color: #555;
}

.brief-row .label {
    width: 140px;
    text-align: right;
    color: #888;
    font-size: 14px;
    font-weight: normal;
    flex-shrink: 0;
}

.brief-row .value {
    font-size: 16px;
    color: #111;
    font-weight: 500;
    text-align: left;
    word-break: break-word;
}

.watch-video {
    margin-top: 15px;
    padding: 10px 24px;
    font-size: 18px;
    cursor: pointer;
    background: transparent;
    border: 2px solid #444;
    border-radius: 6px;
    transition: background 0.3s, color 0.3s;
}

.watch-video:hover {
    background: #444;
    color: #fff;
}

.rent-include-block {
    display: block;
    position: relative;
    top: -5px;
    line-height: 1;
}


/* 套房 */
.value .studio-tag {
    font-size: 12px;
    font-weight: 400;
    color: #555;
    margin-left: 0;
    white-space: normal;
    line-height: 1;
}

/* /坪 行為完全複製 /月，但不影響數字本體 */
.area-display {
    display: inline-flex;        /* 重點：不要撐滿整行 */
    align-items: baseline;
}

.area-display .per {
    font-size: 12px;
    font-weight: 400;
    color: #555;
    margin-left: 2px;            /* 比 /月 更貼，避免太跳 */
}

.house-contact {
    display: flex;
    align-items: center;
    margin-top: 40px;
    gap: 20px;
    flex-wrap: wrap;
}

.contact-img {
    width: 140px;
    flex-shrink: 0;
}

.contact-text h3 {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: bold;
}

.contact-text p {
    margin: 5px 0;
    font-size: 14px;
}

.house-feature {
    display: block;          /* ⬅️ 改成 block，讓標題和 icons 垂直排列 */
    margin-top: 40px;
}

.feature-text {
    margin-bottom: 40px;     /* 標題與 icons 的距離 */
}

.feature-text h3 {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: bold;
}

.feature-text p {
    margin: 5px 0;
    font-size: 14px;
}

/* === 預設 (apartment) === */
.house-feature.apartment .feature-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 40px 40px;           /* 行距40px，左右間距40px */
    margin-top: 0;
    justify-content: flex-start;
}

/* === 辦公室 (office) === */
.house-feature.office .feature-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 40px 80px;           /* 行距40px，左右間距80px ➕ 更寬 */
    margin-top: 0;
    justify-content: flex-start;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;              /* icon 區塊寬度 */
    opacity: 0.3;             /* 預設灰色 */
    text-align: center;
}

.feature-item.active {
    opacity: 1;               /* 有的才全亮 */
}

.feature-item img {
    width: 36px;              /* icon 放大 */
    height: 36px;
    margin-bottom: 6px;       /* icon 與文字的距離 */
}

.feature-subtitle {
    margin: 0 0 15px;
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.feature-item span {
    font-size: 14px;
    white-space: nowrap;   /* ⬅️ 文字一律單行 */
}

.house-rentInclude {
    margin-top: 40px; /* 與上方區塊間距 */
}

.rentInclude-text h3 {
    margin: 0 0 10px;   /* 與 subtitle 的間距 */
    font-size: 20px;
    font-weight: bold;
}

.rentInclude-subtitle {
    margin: 5px 0 15px; /* 與上面標題和下面內容拉開距離 */
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

/* ✅ 補：手機版排版為上下 */
@media screen and (max-width: 767px) {
    .house-detail-wrapper {
        padding: 0;     /* 移除左右 padding */
    }

    .house-detail-grid {
        display: block;
    }

    .house-gallery,
    .house-info {
        flex: none;
        width: 100%;
    }

    .house-feature.apartment .feature-icons {
        justify-content: center;   /* 手機版置中 */
        gap: 24px 24px;            /* 可依需求調整行距、左右間距 */
    }

    .house-feature.office .feature-icons {
        justify-content: center;   /* 手機版置中 */
        gap: 24px 24px;            /* 可依需求調整行距、左右間距 */
    }
}

/* ✅ YouTube Modal 視窗樣式 */
.video-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    padding: 20px;
}

.video-modal-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: pointer;
}

.video-modal-content {
    position: relative;
    max-width: 960px;
    width: 100%;
    max-height: 80vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    z-index: 10000;
}

.video-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    color: white;
    font-size: 28px;
    border: none;
    cursor: pointer;
    z-index: 10001;
}

.video-modal-player {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.video-modal-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ✅ 圖片 Lightbox 多圖瀏覽器 */
.image-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.lightbox-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    cursor: zoom-out;
}

.lightbox-frame {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    color: white;
    font-size: 28px;
    border: none;
    cursor: pointer;
    z-index: 10002;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    color: white;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0,0,0,0.6);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

/* --- Fix: Watch Video 按鈕顏色被主題覆寫、手機置中 --- */
.house-detail-wrapper .watch-video,
.house-detail-wrapper .watch-video:visited,
.house-detail-wrapper .watch-video:active,
.house-detail-wrapper .watch-video:focus {
    color: #444;                  /* 強制文字色，避免被 a:link/a:visited 藍色覆寫 */
    text-decoration: none;        /* 保證沒有底線 */
    -webkit-appearance: none;     /* iOS reset */
    appearance: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* --- 覆寫層：確保 hover 文字一定是白色（壓過你上面那條顏色鎖死） --- */
.house-detail-wrapper .watch-video:hover,
.house-detail-wrapper .watch-video:active {
    color: #fff !important;
    background: #444 !important;
}
/* body 被加上 hd-no-scroll 時鎖住背景 */
.hd-no-scroll {
    position: fixed;   /* 配合 top 記憶法 */
    left: 0; right: 0;
    overflow: hidden !important;
    width: 100%;
}

@media screen and (max-width: 767px) {
    .house-detail-wrapper .watch-video {
        display: block;
        margin: 18px auto 0;      /* 手機置中 */
        text-align: center;
        width: 100%;
        max-width: 100%;
    }
}

/* --- Fix: 手機影片 Modal 與 Lightbox 版面 --- */
@media screen and (max-width: 767px) {
    .video-modal { padding: 0; }  /* 滿版覆蓋，避免外圈空隙導致錯位 */

    .video-modal-content {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;         /* 手機去圓角，避免黑邊 */
    }

    .video-modal-player {
        width: 100vw;
        aspect-ratio: 16 / 9;     /* 以比例控制高度，橫直切換不跑版 */
    }

    .image-lightbox { padding: 0; } /* 滿版預覽 */

    .lightbox-frame {
        max-width: 100vw;
        max-height: 100vh;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 28px;
        background: rgba(0,0,0,0.5);
    }

    .lightbox-prev { left: 10px; }     /* 原本 -60px 會把按鈕推到螢幕外 */
    .lightbox-next { right: 10px; }
}

/* --- Fix: 輪播點與左右鍵觸控體驗 --- */
@media (hover: none) and (pointer: coarse) {
    .carousel-prev,
    .carousel-next {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    .dot { width: 12px; height: 12px; }
}

@media screen and (max-width: 767px) {
    .house-detail-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .house-gallery,
    .carousel,
    .carousel-image,
    .house-info,
    .watch-video {
        width: 100%;
        border-radius: 0;
        box-sizing: border-box;
    }

    .carousel {
        aspect-ratio: 16 / 9;
    }

    .carousel-image {
        position: absolute;
        object-fit: cover;
        height: 100%;
        top: 0;
        left: 0;
    }

    .house-info {
        padding: 0 12px;
    }

    .watch-video {
        padding: 12px 16px;
        font-size: 18px;
        width: 100%;
        margin: 16px auto 0;
        text-align: center;
    }
}
