/* =================================================================
 * 1. CSS 變數 (Colors & Typography)
 * -----------------------------------------------------------------
 * 調整後的色系：更貼近 NETI 圖片的米灰色/大理石紋理
 * ================================================================= */
:root {
    /* 主要色系 */
    --color-primary: #a7978e;     /* 主色/行動色：沉穩的淺棕/灰褐色 */
    --color-secondary: #4b443c;   /* 輔色：深咖啡/幾乎黑色，用於標題 */
    --color-background: #e8e2e0;  /* 背景：略帶灰調的淺米色 */
    --color-surface: #ffffff;     /* 表面/卡片：白色 */
    
    /* 文字色系 */
    --color-text-main: #5a5a5a;   /* 主文本色 */
    --color-text-dark: #3a3632;   /* 深文本色 (用於 hover/重要文字) */
    
    /* 佈局/字體 */
    --max-content-width: 1200px;
    --font-family-main: 'Microsoft JhengHei', 'PingFang TC', Arial, sans-serif;
}

/* =================================================================
 * 2. 基本重置 (Base/Reset)
 * ----------------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-width: 320px; 
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family-main);
    color: var(--color-text-main);
    line-height: 1.7;
    background: var(--color-background);
    /* 確保全寬度，避免水平滾動條 */
    overflow-x: hidden; 
}

/* =================================================================
 * 3. 核心佈局 (Layout: Header, Nav, Content)
 * ----------------------------------------------------------------- */

/* --- Header: 必須是全寬背景 --- */
.header {
    /* 調整 Header 漸層色，使其更接近品牌圖片的柔和灰色調 */
    background: linear-gradient(135deg, #ddd8d6 0%, var(--color-background) 100%);
    padding: 20px 30px;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

/* Header 內部內容居中 */
.header-content {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 20px; 
    overflow: hidden;
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 42px;
    font-weight: 300;
    color: var(--color-secondary);
    letter-spacing: 3px;
}

.header p {
    margin: 0;
    font-size: 18px;
    color: #9f9693;
    font-weight: 300;
}

/* --- Navigation: 必須是全寬背景且固定在頂部 --- */
.nav-container {
    background: var(--color-surface);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Navigation 內容居中對齊 Content */
.nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
    margin: 0 auto;
    list-style: none;
    max-width: var(--max-content-width); 
}

.nav-item {
    flex-grow: 1;
    text-align: center;
}

.nav-button {
    width: 100%;
    padding: 20px 15px;
    background: transparent;
    border: none;
    color: var(--color-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    font-weight: 400;
}

.nav-button:hover {
    background: #fcfcfc;
    color: var(--color-text-dark);
}

.nav-button.active {
    border-bottom-color: var(--color-primary);
    color: var(--color-text-dark);
    font-weight: 500;
}

/* --- Content: 主要內容區塊 --- */
.content {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 50px 30px;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =================================================================
 * 4. 組件 (Components: Card, Button, Price Table)
 * ----------------------------------------------------------------- */

/* --- Card: 通用卡片樣式 --- */
.card {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.card h2 {
    color: var(--color-secondary);
    font-size: 28px;
    margin: 0 0 20px 0;
    font-weight: 400;
    border-bottom: 2px solid #e8dfd6;
    padding-bottom: 15px;
}

.card h3 {
    color: #9f9693;
    font-size: 22px;
    margin: 30px 0 15px 0;
    font-weight: 400;
}

.card p {
    color: #6b6b6b;
    font-size: 16px;
    margin: 0 0 15px 0;
    line-height: 1.8;
}

.card ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.card li {
    padding: 12px 0;
    color: #6b6b6b;
    font-size: 18px;
    border-bottom: 1px solid #f5f1ed;
    position: relative;
    padding-left: 25px;
}

.card li:last-child {
    border-bottom: none;
}

.card li:before {
    content: "✦";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-size: 16px;
}

/* 列表內的小字樣式 */
.content li small {
    color: #666;
    font-style: italic;
    display: block;
    margin-top: 4px;
    font-size: 16px;
}

/* 列表內的超連結樣式 */
.card li a {
    color: var(--color-primary); 
    text-decoration: none; 
    font-weight: 500;
    transition: color 0.3s ease;
}

.card li a:hover {
    color: var(--color-text-dark);
    text-decoration: underline;
}

/* --- Price Table: 服務價格表單項目 --- */
.price-table {
    margin: 30px 0;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 15px 0;
    background: #faf8f6;
    border-radius: 12px;
    border-left: 4px solid var(--color-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.price-item:hover {
    background: #f5f1ed;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.price-item .service-name {
    font-weight: 500;
    color: var(--color-text-dark);
    font-size: 18px;
}

.price-item .service-price {
    font-weight: 600;
    color: var(--color-secondary);
    font-size: 16px;
}

/* --- Link Button: 行動呼籲按鈕 --- */
.link-button {
    display: inline-block;
    padding: 15px 35px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #9a8a81 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 25px;
    margin: 20px 10px 10px 0;
    transition: all 0.3s ease;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(167, 151, 142, 0.3);
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(167, 151, 142, 0.4);
    background: linear-gradient(135deg, #9a8a81 0%, #8c7e75 100%);
}

/* --- Icon decorations --- */
.icon {
    display: inline-block;
    margin-right: 10px;
    font-size: 20px;
}

/* =================================================================
 * 5. 特定用途樣式 (Utilities: Testimonial, Notice, Contact Cards)
 * ----------------------------------------------------------------- */

/* --- Testimonial Card: 客戶見證/引言區塊 --- */
.testimonial {
    background: linear-gradient(135deg, #faf8f6 0%, #f5f1ed 100%);
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    border-left: 5px solid var(--color-primary);
    position: relative;
    z-index: 1;
}

.testimonial p, .testimonial-author {
    position: relative;
    z-index: 2; 
}

/* 裝飾性引號 */
.testimonial:before {
    content: ""; /* 不使用內容，使用背景圖或 font-icon 更佳，但維持原樣 */
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 60px;
    color: #e8dfd6;
    font-family: Georgia, serif;
}

.testimonial-author {
    text-align: right;
    color: #9f9693;
    font-size: 15px;
    font-weight: 500;
}

/* --- Notice Box: 通知/強調區塊 --- */
.notice-box {
    background: #fbf9f8;
    border: 2px solid #e8dfd6;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
}

.notice-box h4 {
    color: var(--color-secondary);
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 500;
}

/* --- Contact Cards: 聯絡區塊 (Grid 佈局) --- */
.contact-card-list-container {
    display: grid;
    /* 桌面版：分成 3 欄，且自動適應 */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
    margin: 30px auto;
}

.contact-card {
    display: block;
    text-align: center;
    padding: 30px;
    background: var(--color-surface);
    border-radius: 20px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.06); 
    text-decoration: none;
    color: var(--color-text-main);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.contact-card i {
    font-size: 36px;
    margin-bottom: 15px;
    color: var(--color-primary); 
}

.contact-card h4 {
    margin: 0 0 5px 0;
    color: var(--color-secondary);
    font-weight: 500;
    font-size: 18px; 
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 針對 H4 內行內 PNG 圖片設定樣式 */
.contact-card h4 .h4-inline-icon {
    width: 18px; 
    height: 18px; 
    margin-right: 8px; 
    vertical-align: middle;
}

.contact-card p {
    font-size: 14px;
    color: #8b8888; 
    margin: 0;
    line-height: 1.6;
}

/* =================================================================
 * 6. 響應式設計 (Media Queries)
 * ----------------------------------------------------------------- */

@media (max-width: 768px) {
    /* --- Header --- */
    .header {
        padding: 30px 20px; 
    }

    .header h1 {
        font-size: 26px;
    }

    .header p {
        font-size: 16px;
    }
    
    /* --- Navigation: 實現四欄橫向佈局 --- */
    .nav {
        justify-content: space-around;
        flex-wrap: nowrap; /* 確保不換行 */
    }

    .nav-button {
        font-size: 14px;
        padding: 15px 5px; /* 縮小左右 padding 以騰出空間 */
    }
    
    .nav-item {
        /* 【關鍵修正 1】：讓每個項目都平均分配空間，確保四個項目可以並排 */
        flex: 1 1 25%;
        min-width: unset;
    }
    
    /* --- 手機版下拉選單修正 (實現懸浮效果和收合) --- */
    .nav-item.dropdown {
        /* 保持相對定位 */
        position: relative; 
    }

    .submenu {
        /* 【關鍵修正 2】：在手機上保持絕對定位，實現懸浮效果 */
        position: absolute; 
        
        /* 讓選單置中於其父按鈕 (.nav-item.dropdown) 下方 */
        left: 50%; 
        transform: translateX(-50%); 
        
        /* 設定選單寬度，不要超過螢幕，但要足夠顯示內容 */
        min-width: 150px; 
        max-width: 90vw; /* 確保選單不會超出螢幕邊界 */
        
        /* 恢復視覺樣式，讓它看起來是懸浮卡片 */
        background: var(--color-surface);
        box-shadow: 0 0 10px rgba(0,0,0,0.15); /* 輕微陰影 */
        border-radius: 5px;
        border-top: none; 
        
        z-index: 1000;
        
        /* 確保隱藏/顯示邏輯正確 */
        display: none;
        opacity: 0;
        visibility: hidden;
    }

    /* 確保手機上 hover 不會意外觸發顯示 (這會覆蓋桌面版的 hover 樣式)
    .dropdown:hover .submenu {
        display: none !important;
        visibility: hidden !important; 
    } */

    /* 只在 .dropdown.active-dropdown 被點擊時顯示 */
    .dropdown.active-dropdown .submenu {
        display: block;
        opacity: 1;
        visibility: visible;
    }
    
    /* --- Content & Cards --- */
    .content {
        padding: 30px 20px;
    }

    .card {
        padding: 25px;
    }

    .card h2 {
        font-size: 24px;
    }

    /* --- Price Table --- */
    .price-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* --- Contact Cards (Grid) --- */
    .contact-card-list-container {
        /* 手機版：堆疊為單欄 */
        grid-template-columns: 1fr; 
        gap: 15px;
        padding: 0 30px;
    }

    .contact-card {
        padding: 20px; 
    }
}

/* =================================================================
 * 7. 下拉式選單樣式 (Dropdown)
 * ----------------------------------------------------------------- */
.nav-item.dropdown {
    position: relative; /* 讓子選單可以相對於此項目定位 */
    flex-grow: 1;
    text-align: center;
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    
    /* 定位在主按鈕下方 */
    position: absolute;
    top: 100%; /* 位於父元素下方 */
    left: 50%;
    transform: translateX(-50%);
    
    /* 視覺樣式 */
    background: var(--color-surface);
    min-width: 180px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden;
    z-index: 1000;
    
    /* 預設隱藏 【修正】：新增 visibility */
    display: none;
    opacity: 0;
    visibility: hidden; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 顯示下拉選單時的樣式 【修正】：確保桌面滑鼠滑過和點擊都有效 */
/* .dropdown:hover .submenu, */
.dropdown.active-dropdown .submenu {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* 下拉選單內部的按鈕和項目樣式調整 */
.submenu .nav-item {
    width: 100%; /* 讓子選單項目佔滿寬度 */
}

.submenu .nav-button {
    padding: 12px 15px; /* 調整子選單按鈕的填充 */
    border-bottom: none; /* 移除子選單按鈕的底部橫線 */
    font-size: 15px;
    text-align: left;
}

.submenu .nav-button:hover {
    background: #f0f0f0;
}

/* =================================================================
 * 8. 底部連結 (Footer Link)
 * ----------------------------------------------------------------- */
.footer-link-container {
    text-align: center;
    padding: 40px 0 60px 0; /* 增加上下間距 */
    border-top: 1px solid #dcd7d5; /* 輕微分隔線 */
    margin-top: 50px;
    background: var(--color-background); 
}

.back-to-top-link {
    display: inline-block;
    color: var(--color-primary); /* 使用主色系 */
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.back-to-top-link:hover {
    background: var(--color-primary);
    color: var(--color-surface); /* 文字變為白色 */
    text-decoration: none;
}

    .footer-link-container {
        /* 在手機上減少間距，讓內容更緊湊 */
        padding: 30px 20px 40px 20px; 
        margin-top: 30px;
    }

    .back-to-top-link {
        /* 在手機上可以讓按鈕寬度略微加大，更容易點擊 */
        width: 100%; 
        max-width: 250px; /* 限制最大寬度，避免過寬 */
        padding: 12px 15px;
        font-size: 15px;
    }