/* ========= Reset 預設重設 ========= */
* {
    margin: 0;
    /* 移除所有元素的外邊距 */
    padding: 0;
    /* 移除所有元素的內邊距 */
    box-sizing: border-box;
    /* 設定 box-sizing 為 border-box，使寬高包含 padding 與 border */
}

html,
body {
    overflow-x: hidden;
}

/* ========= 全域設定 ========= */
body {
    font-family: "Segoe UI", sans-serif;
    /* 設定全站字型 */
    /* background: #f4f4f4; */
    /* 移除背景色，與 index 保持一致 */
    color: #333;
    /* 預設文字顏色 */
}

/* ========= 主容器設定 ========= */
.container {
    width: 90%;
    /* 寬度為畫面的 90% */
    max-width: 1200px;
    /* 最大寬度限制為 1200px */
    margin: auto;
    /* 水平置中 */
    display: flex;
    /* 使用 Flex 排版 */
    justify-content: space-between;
    /* 子項目左右對齊 */
    align-items: center;
    /* 垂直置中 */
    flex-wrap: wrap;
    /* 允許子項目自動換行 */
}

/* ========= 導覽列主體 ========= */
.navbar {
    background: #002244;
    /* 深藍色背景 */
    color: #fff;
    /* 白色文字 */
    padding: 15px 0;
    /* 上下內邊距 */
    width: 100%;
    /* 滿版寬度 */
}

/* ========= 導覽列內部容器 ========= */
.navbar .container {
    position: relative;
    /* 為漢堡選單定位提供基準 */
    width: 100%;
    /* 寬度滿版 */
    max-width: 100%;
    /* 不限制最大寬度 */
    margin: 0 auto;
    /* 水平置中 */
    display: flex;
    /* 使用 Flex 排列內容 */
    justify-content: space-between;
    /* 左右貼齊對齊 */
    align-items: center;
    /* 垂直置中對齊 */
    padding: 0;
    /* 移除內距 */
}

/* ========= Logo 區塊 ========= */
.navbar .logo {
    font-size: 24px;
    /* 字體大小 */
    font-weight: bold;
    /* 字體加粗 */
    color: white;
    /* 白色文字 */
    margin-left: 60px;
    /* 靠左內距 */
}

.logo-img {
    height: 60px;
}

/* ========= 導覽連結容器 ========= */
.navbar nav .nav-links {
    list-style: none;
    /* 移除清單點點 */
    display: flex;
    /* 水平排列 */
    gap: 20px;
    /* 項目之間的間距 */
    padding-right: 60px;
    /* 靠右內距 */
    flex-wrap: wrap;
    /* 項目可換行 */
}

/* ========= 導覽項目（li）設定 ========= */
.navbar .nav-links li {
    padding-left: 10px;
    /* 左內距 */
    padding-right: 10px;
    /* 右內距 */
}

/* ========= 導覽超連結樣式 ========= */
.navbar .nav-links li a {
    color: white;
    /* 白色文字 */
    text-decoration: none;
    /* 移除底線 */
    font-weight: 500;
    /* 中等字重 */
    font-size: 18px;
    /* 字體大小 */
    transition: color 0.3s;
    /* 滑鼠懸停時顏色變化過渡效果 */
}

.section-title {
    font-size: 40px;
    font-weight: bold;
    text-align: center;
    margin: -20px 0 20px 0;
    color: #002244;
    position: relative;
    display: inline-block;
    font-weight: 600;
}

.section-title::after {
    content: "";
    display: block;
    width: 100px;
    height: 6px;
    background-color: #002244;
    /* 深藍色，與導覽列呼應 */
    margin: 10px auto 0;
    border-radius: 2px;
}

.box-subtitle {
    position: absolute;
    top: 15px;
    left: 30px;
    font-size: 27px;
    font-weight: 600;
    color: #1e3a5f;
    border-left: 6px solid #1e3a5f;
    padding-left: 12px;
    background-color: transparent;
}

.chat-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* ✅ 將每塊 message-box 水平置中 */
    gap: 50px;
    /* ✅ 區塊之間距離大一點 */
    padding: 50px 20px;
    /* ✅ 上下左右留白空間 */
    max-width: 1100px;
    /* ✅ 設定最大寬度 */
    margin: 0 auto;
    /* ✅ 水平置中 chat-section */
}

.message-box {
    position: relative;
    /* ✅ 讓內部小標題可以定位 */
    width: 1000px;
    max-width: 90vw;
    /* ✅ 加上最大寬度限制 */
    height: auto;
    /* ✅ 高度自動調整 */
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* ✅ 不再兩端對齊，改為靠左（或靠右） */
    gap: 30px;
    /* ✅ 設定圖片與 bubble 間距 */
    background-color: #eee;
    border-radius: 0px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-box.left {
    flex-direction: row;
}

.message-box.right {
    flex-direction: row-reverse;
}

.avatar-box {
    width: 230px;
    /* ✅ 外框寬度 */
    height: 230px;
    /* ✅ 外框高度 */
    background-color: white;
    /* ✅ 背景白色，讓圖片底透明區不會透出底色 */
    border: 2px solid #ccc;
    /* ✅ 灰色邊框 */
    display: flex;
    /* ✅ 使用 flex，讓圖片置中 */
    align-items: center;
    /* ✅ 垂直置中 */
    justify-content: center;
    /* ✅ 水平置中 */
    margin: 40px 2px 0 2px;
    /* ⬅️ 上右下左，圖片往下推 */
    /* ✅ 左右間距 20px，讓圖片與對話框有空隙 */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    /* ✅ 加上陰影讓框更立體 */
}

.avatar {
    width: 100%;
    /* ✅ 圖片寬度 */
    height: 100%;
    /* ✅ 圖片高度 */
    object-fit: cover;
    /* ✅ 等比例裁切填滿，圖片不會被拉伸變形 */
    border-radius: 0;
    /* ✅ 無圓角（保留方形外觀） */
}

.bubble {
    margin-top: 40px;
    width: 100%;
    /* ✅ 寬度改為 100% */
    max-width: 700px;
    /* ✅ 最大寬度維持 700px */
    height: auto;
    /* ✅ 高度自動 */
    min-height: 200px;
    background-color: #fff;
    padding: 18px 24px;
    border-radius: 20px;
    font-size: 22px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    text-align: justify;
}

.message-box.left .bubble::before {
    content: "";
    position: absolute;
    left: -22px;
    top: 30px;
    width: 0;
    height: 0;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-right: 22px solid #ccc;
    /* 外層「邊框」顏色 */
}

.message-box.left .bubble::after {
    content: "";
    position: absolute;
    left: -20px;
    /* 相對略靠內，形成邊框效果 */
    top: 30px;
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid #fff;
    /* 泡泡背景色 */
}

.message-box.right .bubble::before {
    content: "";
    position: absolute;
    right: -22px;
    top: 30px;
    width: 0;
    height: 0;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-left: 22px solid #ccc;
    /* 外層邊框色 */
}

.message-box.right .bubble::after {
    content: "";
    position: absolute;
    right: -20px;
    top: 30px;
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 20px solid #fff;
    /* 泡泡背景色 */
}

/* ========= 版權區塊 ========= */
.copyright {
    background-color: #000000;
    /* 白底 */
    color: #ffffff;
    /* 字色深灰 */
    text-align: center;
    /* 置中對齊 */
    font-size: 14px;
    /* 字體大小 */
    padding: 12px 0;
    /* 上下內距 */
    border-top: 1px solid #ddd;
    /* 上邊框 */
}

/* ========= 懸停變色效果 ========= */
.navbar .nav-links li a:hover {
    color: #00bfff;
    /* 懸停時變成亮藍色 */
}

/* ========= 響應式：漢堡選單按鈕 ========= */
.menu-toggle {
    display: none;
    /* 預設隱藏（僅手機版顯示） */
    font-size: 32px;
    /* 字體大小 */
    color: white;
    /* 白色圖示 */
    cursor: pointer;
    /* 游標變成手型 */
    padding: 10px 20px;
    /* 內距 */
    position: absolute;
    /* 絕對定位於右上角 */
    right: 0;
    /* 靠右對齊 */
    top: 50%;
    /* 垂直置中 */
    transform: translateY(-50%);
    /* 垂直平移置中 */
    z-index: 1001;
    /* 層級高於選單本體 */
    background: transparent;
    /* 背景透明 */
}

/* ========= 桌面版選單顯示（預設） ========= */
.menu {
    display: block;
    /* 導覽選單預設為顯示 */
}

/* Mobile Break Utility */
.mobile-break {
    display: none;
}

/* ========= 回到頂部按鈕 ========= */
#backToTopBtn {
    display: none;
    /* 預設隱藏 */
    position: fixed;
    /* 固定位置 */
    bottom: 20px;
    /* 距離底部 20px */
    right: 30px;
    /* 距離右邊 30px */
    z-index: 99;
    /* 確保在最上層 */
    border: none;
    /* 無邊框 */
    outline: none;
    /* 無輪廓 */
    background-color: #002244;
    /* 背景色 */
    color: white;
    /* 文字顏色 */
    cursor: pointer;
    /* 游標變手指 */
    padding: 15px;
    /* 內距 */
    border-radius: 50%;
    /* 圓形 */
    font-size: 18px;
    /* 字體大小 */
    width: 50px;
    height: 50px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.3s;
}

#backToTopBtn:hover {
    background-color: #00bfff;
    /* 懸停變色 */
    transform: translateY(-3px);
}

/* ========= 響應式設計：手機版樣式 ========= */
@media (max-width: 768px) {
    .logo-img {
        height: 50px;
    }

    .menu-toggle {
        display: block;
        /* 顯示漢堡按鈕 */
    }

    .navbar .logo {
        margin-left: 15px !important;
        /* 改小一點 */
    }

    .menu {
        position: fixed;
        /* 固定選單位置 */
        top: 0;
        /* 從畫面頂部開始 */
        right: -300px;
        /* 初始隱藏於右側畫面外 */
        width: 60vw;
        /* 選單寬度 */
        max-width: 110px;
        height: 100%;
        /* 滿版高度 */
        background-color: #002244;
        /* 背景色深藍 */
        padding-top: 60px;
        /* 上方留白以避開 logo */
        transition: right 0.3s ease;
        /* 滑出動畫 */
        z-index: 1000;
        /* 層級設定 */
    }

    .menu.open {
        right: 0;
        /* 加上 open 類別時滑出選單 */
    }

    .nav-links {
        flex-direction: column;
        /* 導覽列改為直排 */
        gap: 20px;
        /* 每項間距 */
        padding: 0 20px;
        /* 內距避免文字貼邊 */
    }

    .nav-links li {
        padding: 10px 0;
        /* 垂直內距方便點擊 */
    }

    .nav-links a {
        padding-left: 5px;
        /* 左側距離，可依需求調整 */
    }

    /* Merged from Block 2 */
    .navbar .container {
        flex-direction: column;
        /* 導覽列主容器改為直向排列 */
        align-items: flex-start;
        /* 導覽列內部元素靠左 */
        position: relative;
        /* 漢堡選單以此為定位基準 */
    }

    .navbar nav .nav-links {
        flex-direction: column;
        /* 導覽連結改為縱向排列 */
        padding-left: 0;
        /* 左邊距設為 0 */
        padding-right: 0;
        /* 右邊距設為 0 */
    }

    .section-title {
        font-size: 30px;
    }

    .section-title::after {
        width: 50px;
        height: 5px;
        margin-top: 6px;
    }

    /* Merged from Block 3 */
    .chat-section {
        padding: 30px 10px;
        gap: 50px;
    }

    .message-box {
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: auto;
        padding: 20px;
        gap: 20px;
    }

    .box-subtitle {
        position: static;
        /* 取消絕對定位，讓它自然排列 */
        width: 100%;
        /* 佔滿寬度 */
        text-align: center;
        /* 文字置中 */
        border-left: none;
        /* 移除左邊框 */
        border-bottom: 3px solid #1e3a5f;
        /* 改為下邊框 */
        padding-left: 0;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .avatar-box {
        width: 200px;
        height: 200px;
        margin-top: 0;
        /* 取消上方間距，因為標題已經佔位 */
        margin-bottom: 15px;
    }

    .bubble {
        width: 100%;
        max-width: 100%;
        font-size: 18px;
        height: auto;
        margin-top: 0px;
    }

    .message-box.left .bubble::before,
    .message-box.left .bubble::after,
    .message-box.right .bubble::before,
    .message-box.right .bubble::after {
        display: none;
    }

    /* Merged from Block 4 */
    .mobile-break {
        display: block;
    }
}