/* 重置基本樣式並設置全屏顯示 */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow-x: hidden; /* 防止水平滾動 */
    scroll-behavior: smooth; /* 添加平滑滾動效果 */
    background-color: #fff;
    color: #333;
}

/* 背景圖片容器樣式 */
.bg-image {
    position: fixed; /* 固定定位 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1; /* 置於最底層 */
}

/* 背景圖片樣式 */
.bg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 確保圖片填滿容器且不變形 */
    object-position: center; /* 圖片居中顯示 */
}

/* 遮罩層樣式 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(51, 37, 37, 0.3); /* 灰色遮罩，透明度 0.4 */
    z-index: -1; /* 置於背景圖片之上 */
}

/* 統一基本導覽列樣式 (用於所有頁面) */
.nav-bar {
    position: fixed; /* 預設為固定定位，跟隨視窗滾動 */
    top: 50px;
    right: 40px;
    z-index: 100;
    display: flex;
    justify-content: center;
    transition: opacity 0.5s ease; /* 添加透明度過渡效果 */
}

/* 添加導覽列懸停區域 */
.nav-hover-area {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%; /* 使用100%寬度覆蓋整個頂部區域 */
    height: 150px; /* 導覽列高度加上額外空間 */
    z-index: 99;
    pointer-events: none; /* 默認不接收滑鼠事件，只在導覽列隱藏時啟用 */
}

/* 當滑鼠懸停在懸停區域上時，確保導覽列顯示 */
.nav-hover-area:hover ~ .nav-bar,
.nav-bar:hover {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 當在影片幻燈片上時，確保導覽列懸停區域不會干擾 */
.carousel-slide:nth-child(2):hover ~ .nav-hover-area,
.carousel-slide:nth-child(2):hover ~ .logo-hover-area {
    pointer-events: none !important;
    z-index: -1 !important;
}

/* 視頻容器的特定樣式調整，確保最大相容性 */
.carousel-slide:nth-child(2) {
    position: relative;
    z-index: 5;
}

.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    margin: 0 15px;
}

.nav-item a {
    font-family: 'Frank Ruhl Libre', serif;
    color: #fff;
    text-decoration: none;
    font-size: 1.6rem; /* 字體調整 */
    padding: 10px;
    display: block;
    transition: all 0.5s ease; /* 增加過渡時間 */
    text-align: center;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1),
                4px 4px 8px rgba(0, 0, 0, 0.6),
                5px 5px 10px rgba(0, 0, 0, 0.4); /* 調整陰影向右下方 */
}

.nav-item > a {
    font-weight: 500;
}

.nav-item a:hover {
    color: rgba(255, 255, 255, 0.7);
    transform: translateY(-3px); /* A hover 時微微上移 */
}

/* 下拉選單樣式 */
.dropdown {
    position: absolute;
    top: 90%; /* 調整下拉選單位置往上移 */
    left: 0; /* 改為左側0，與導覽列選項左側切齊 */
    transform: translateX(0); /* 移除水平位移 */
    background-color: rgba(255, 255, 255, 0.5);
    width: auto; /* 根據內容自動調整寬度 */
    min-width: 0px; /* 設定最小寬度 */
    border-radius: 0; /* 取消圓角 */
    padding: 10px 0;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* 減淡陰影 */
    list-style: none;
    z-index: 1000; /* 確保下拉選單顯示在最上層 */
}

.dropdown li {
    padding: 0;
    margin: 0;
}

.dropdown li a {
    font-family: 'Frank Ruhl Libre', serif;
    padding: 8px 15px; /* 減少右側內距使文字更靠左 */
    font-size: 1rem;
    white-space: nowrap; /* 不允許文字換行 */
    overflow: visible; /* 確保文字不被截斷 */
    text-align: left; /* 文字左對齊 */
    color: #000; /* 預設黑色文字 */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); /* 添加較淡的文字陰影 */
}

.dropdown li a:hover {
    background-color: rgb(88, 49, 25, 0.8); /* 改為深棕色背景 */
    color: #fff; /* hover時改為白色文字 */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); /* hover時的文字陰影 */
}

.nav-item:hover .dropdown {
    display: block;
}

/* 調整 logo 位置以適應新的布局 - 添加過渡效果 */
.logo {
    position: fixed;
    top: -20px;
    left: 60px;
    z-index: 101; /* 確保 logo 顯示在最上層，甚至超過導覽列 */
    max-width: 200px;
    transition: opacity 0.5s ease; /* 添加透明度過渡效果 */
}

/* Logo 圖片樣式 */
.logo img {
    width: 180px; /* 加大 logo 寬度 */
    height: auto; /* 保持圖片比例 */
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.4))
            drop-shadow(-1px -1px 2px rgba(0, 0, 0, 0.3))
            drop-shadow(0px 0px 5px rgba(255, 255, 255, 0.5));
}

/* Logo 懸停區域 */
.logo-hover-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px; /* logo區域寬度 */
    height: 120px; /* logo區域高度 */
    z-index: 99;
    pointer-events: none; /* 默認不接收滑鼠事件，只在logo隱藏時啟用 */
}

/* 當滑鼠懸停在logo懸停區域上時，確保logo顯示 */
.logo-hover-area:hover ~ .logo,
.logo:hover {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 頁面內容框樣式 */
.page-content {
    position: relative;
    z-index: 2;
    width: 80%;
    max-width: 1200px;
    margin: 150px auto 100px;
    background-color: white;
    padding: 60px;
    border-radius: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    color: #333;
}

/* 主視覺區域 */
.main-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 0;
}

.hero-content {
    width: 80%;
    color: #fff;
    z-index: 1;
    text-align: left;
    margin-left: 100px;
    margin-bottom: 50px; /* 減少底部邊距 */
    margin-top: 150px; /* 增加頂部邊距使內容往下移更多 */
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5),
                -1px -1px 2px rgba(0, 0, 0, 0.3),
                0px 0px 8px rgba(255, 255, 255, 0.3);
}

.hero-content h3 {
    font-size: 1.8rem;
    font-weight: 300;
    font-style: italic;
    margin-top: 0;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5),
                -1px -1px 2px rgba(0, 0, 0, 0.3),
                0px 0px 8px rgba(255, 255, 255, 0.3);
}

/* 中間內容區域輪播樣式 */
.content-section {
    background-color: #fff;
    padding: 0;
    position: relative;
    width: 100%;
    z-index: 1;
    overflow: hidden;
}

/* 輪播容器樣式 */
.content-carousel {
    width: 100%;
    position: relative;
    overflow: hidden;
    /* 設定固定高度以匹配YouTube影片 */
    height: 500px;
}

.carousel-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 影片容器樣式 */
.video-container {
    width: 100%;
    height: 100%;
    padding: 0;
    background-color: #6b5a4a; /* 棕色背景填充兩側空白 */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 5;
    pointer-events: auto;
    max-height: 500px; /* 確保容器高度固定 */
}

.video-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 11;
    cursor: pointer;
}

/* 16:9 影片包裝容器 */
.video-wrapper {
    width: auto;
    height: 100%;
    max-height: 500px; /* 與容器相同的最大高度 */
    aspect-ratio: 16/9; /* 設定 16:9 的比例 */
    background-color: #000;
    position: relative;
    z-index: 10;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* 移除舊的 iframe 和 ::after 樣式 */
.video-container::after {
    display: none;
}

.video-container > iframe {
    display: none;
}

/* 輪播控制按鈕 */
.carousel-controls {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2;
    pointer-events: none; /* 新增：確保控制容器本身不攔截點擊事件 */
}

.carousel-btn {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 0%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
    pointer-events: auto; /* 新增：確保按鈕可以接收點擊事件 */
}

.carousel-btn.next-btn {
    margin-right: 50px;
}

.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 輪播指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 2;
    pointer-events: none; /* 新增：確保指示器容器不攔截點擊事件 */
}

.indicator {
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    pointer-events: auto; /* 新增：確保指示器本身可以接收點擊事件 */
}

.indicator.active {
    background-color: white;
}

/* 原有內容容器樣式修改 */
.content-container {
    display: flex;
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
}

/* 調整圖片容器高度 */
.clinic-image {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
}

.clinic-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 調整文字描述區域高度 */
.clinic-description {
    width: 50%;
    height: 100%;
    background-color: #6b5a4a;
    color: #fff;
    padding: 60px 40px;
    display: flex;
    align-items: flex-start; /* 改為靠上對齊 */
    overflow-y: auto; /* 如果文字太多，允許滾動 */
}

.clinic-description p {
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: left;
    transition: transform 0.6s ease, opacity 0.8s ease;
    /* 預設狀態，隱藏並位於下方 */
    opacity: 0;
    transform: translateY(30px); /* 減少向下位移的距離 */
    margin-top: 20px; /* 加入上方間距 */
}

/* 當添加此類時，文字會顯示並移動到正確位置 */
.clinic-description p.animated {
    opacity: 1;
    transform: translateY(50px); /* 向上移動 */
}

/* 引言區域 */
.quote-section {
    width: 100%;
    position: relative;
    padding: 180px 0; /* 增加上下間距 */
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quote-section::before {
    content: none; /* 移除遮罩 */
}

.quote-container {
    width: 80%;
    max-width: 1000px;
    position: relative;
    z-index: 1;
    padding: 0 30px 0 50px; /* 調整左側內邊距，給邊框留出空間 */
}

.quote-container p {
    color: #fff;
    font-size: 2.2rem; /* 增大字體 */
    font-style: italic;
    text-align: left; /* 改為左對齊 */
    margin: 0;
    padding: 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1),
                4px 4px 8px rgba(0, 0, 0, 0.6),
                5px 5px 10px rgba(0, 0, 0, 0.4); /* 調整陰影向右下方 */
    letter-spacing: 1.2px;
    line-height: 1.5;
    font-weight: 500;
}

/* 頁尾樣式 */
.static-footer {
    position: relative;
    bottom: 0;
    width: 100%;
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 15px 0;
    z-index: 10;
}

.footer-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-info p {
    margin: 3px 0;
    font-size: 0.85rem;
}

.footer-info a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-info a:hover {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
}

.footer-bottom {
    margin-top: 5px;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* 返回頂部按鈕樣式 */
#backToTopBtn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 0; /* 取消圓角 */
    font-size: 18px;
    width: 50px;
    height: 50px;
    display: none;
    transition: background-color 0.3s ease;
}

#backToTopBtn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 首頁專用樣式 */
.home-page .page-content {
    margin-top: 150px;
}

/* 添加CSS類用於控制透明度 */
.fade-out {
    opacity: 0;
}

.fade-in {
    opacity: 1;
} 

/* 響應式設計 */
@media (max-width: 992px) {
    .content-carousel {
        height: auto;
        min-height: 500px;
    }
    
    .content-container {
        flex-direction: column;
    }
    
    .clinic-image, .clinic-description {
        width: 100%;
        height: auto;
    }
    
    .clinic-image {
        min-height: 250px;
    }
    
    .clinic-description {
        padding: 40px 20px;
    }
    
    .carousel-slide {
        height: auto;
    }
    
    .video-container {
        height: 400px;
    }
    
    .video-container iframe {
        height: 100%;
        max-height: 400px;
    }
    
    .hero-content {
        margin-left: 50px;
    }
    
    .hero-content h2 {
        font-size: 2.5rem;
    }
    
    .quote-container {
        width: 85%;
        padding: 0 25px 0 40px;
    }
    
    .quote-container p {
        font-size: 2rem;
    }
    
    .nav-container {
        height: 85px;
    }
}

@media (max-width: 768px) {
    .content-carousel {
        min-height: 450px;
    }
    
    .clinic-image {
        min-height: 200px;
    }
    
    .video-container {
        height: 350px;
    }
    
    .video-container iframe {
        max-height: 350px;
    }
    
    .nav-bar {
        right: 20px;
    }
    
    .logo {
        left: 20px;
    }
    
    .hero-content {
        width: 90%;
        margin-left: 20px;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content h3 {
        font-size: 1.2rem;
    }
    
    .quote-section {
        padding: 120px 0;
    }
    
    .quote-container {
        width: 90%;
        padding: 0 20px 0 30px;
        border-left: 4px solid rgba(255, 255, 255, 0.8);
    }
    
    .quote-container p {
        font-size: 1.7rem;
        letter-spacing: 1px;
    }
    
    .nav-bar::after {
        left: -20px;
        width: calc(100% + 40px);
    }
    
    .nav-container {
        height: 85px;
    }
}

@media (max-width: 480px) {
    .content-carousel {
        min-height: 400px;
    }
    
    .clinic-image {
        min-height: 180px;
    }
    
    .clinic-description {
        padding: 30px 15px;
    }
    
    .video-container {
        height: 300px;
    }
    
    .video-container iframe {
        max-height: 300px;
    }
    
    .quote-container {
        width: 95%;
        padding: 0 15px 0 25px;
        border-left: 3px solid rgba(255, 255, 255, 0.8);
    }
    
    .quote-container p {
        font-size: 1.4rem;
        letter-spacing: 0.8px;
    }
    
    .nav-item {
        margin: 0 8px;
    }
    
    .nav-item a {
        font-size: 1rem;
    }
    
    .nav-container {
        height: 85px;
    }
}

/* 彈出訊息樣式 */
.popup {
    position: fixed;
    bottom: 30px;
    right: 100px; /* 從30px改為100px，往左移動 */
    background: rgba(255,255,255,0.95);
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    font-size: 1rem;
    max-width: 350px;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.popup.hidden {
    opacity: 0;
    pointer-events: none;
}

#popup-text {
    margin: 0;
    line-height: 1.5;
    color: #333;
}


/* 預約按鈕樣式 */
#bookingBtn {
    position: fixed;
    bottom: 170px; /* 位置在返回頂部按鈕上方，從160px上移至165px */
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    padding: 10px;
    border-radius: 0;
    width: 50px;
    height: 50px;
    display: block; /* 常亮顯示 */
    transition: background-color 0.3s ease;
}

#bookingBtn img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

#bookingBtn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 預約按鈕容器 */
.booking-container {
    position: fixed;
    bottom: 170px;
    right: 30px;
    z-index: 99;
    display: flex;
    align-items: center;
}

/* 預約彈出選項 */
.booking-popup {
    position: absolute;
    right: 60px; /* 位於按鈕左側 */
    top: -50px; /* 確保與按鈕上緣對齊 */
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center; /* 垂直居中 */
    height: 50px; /* 與按鈕同高 */
    overflow: hidden;
    width: 0;
}

.booking-container:hover .booking-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    width: 150px; /* 稍微減小寬度 */
}

.booking-option {
    font-family: 'Dancing Script', cursive;
    color: white;
    text-decoration: none;
    padding: 0 20px;
    white-space: nowrap;
    font-size: 24px; /* 增加字體大小 */
    transition: background-color 0.3s ease;
    text-align: center;
    height: 100%; /* 填滿高度 */
    line-height: 50px; /* 垂直居中文字 */
    width: 100%;
}

.booking-option:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 行動版選單按鈕樣式 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 24px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #fff;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

@media (max-width: 768px) {
    /* 顯示行動版選單按鈕 */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* 調整導覽列樣式 */
    .nav-bar {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.9);
        z-index: 1000;
        transition: right 0.3s ease;
        padding-top: 60px;
    }
    
    .nav-bar::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.9);
        z-index: -1;
    }
    
    .nav-bar.active {
        right: 0;
    }
    
    .nav-links {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-item {
        margin: 10px 0;
        width: 100%;
    }
    
    .nav-item a {
        text-align: left;
        padding: 12px 20px;
        font-size: 1.2rem;
    }
    
    /* 下拉選單樣式調整 */
    .dropdown {
        position: static;
        width: 100%;
        background-color: rgba(50, 50, 50, 0.8);
        box-shadow: none;
        padding: 0;
    }
    
    .dropdown li a {
        padding: 10px 40px;
        font-size: 1rem;
    }
    
    /* 點擊觸發下拉選單 */
    .nav-item:hover .dropdown {
        display: none;
    }
    
    .nav-item.active .dropdown {
        display: block;
    }
    
    /* 調整頁面內容適應行動版 */
    .page-content {
        width: 90%;
        padding: 30px 20px;
        margin-top: 100px;
    }
    
    .video-container {
        height: 300px;
    }
    
    .video-wrapper {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .page-content {
        width: 95%;
        padding: 25px 15px;
    }
    
    .video-container {
        height: 250px;
    }
    
    .video-wrapper {
        max-height: 250px;
    }
}
