:root {
    /* 背景顏色 */
    --bg-white: #ffffff;
    --bg-light-gray: #f8f9fa;
    --bg-hover-gray: #f1f3f5;
    --bg-primary-blue: #0d6efd;
    --bg-user-bubble: #d4f4d8;
    --bg-agent-bubble: #e9ecef;
    --bg-error-bubble: #f8d7da;
    --bg-notification-red: #dc3545;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #7c3aed;

    /* 文字與連結顏色 */
    --text-dark: #1f2937;
    --text-gray: #4b5563;
    --text-time-gray: #6b7280;
    --text-error: #58151c;
    --text-white: #ffffff;
    --text-accent-green: #2f855a;
    --link-blue: #0ea5e9;
    --link-green: #22c55e;

    /* 邊框與陰影 */
    --border-gray: #d1d5db;
    --border-light-gray: #e5e7eb;
    --border-accent-green: #22c55e;
    --border-focus-blue: #60a5fa;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --shadow-dark: rgba(0, 0, 0, 0.2);
    --shadow-pulse: rgba(220, 53, 69, 0.6);
    --shadow-pulse-end: rgba(220, 53, 69, 0);
    --shadow-focus-blue: rgba(96, 165, 250, 0.25); /* 新增：表單焦點陰影 */
}

/* 避免手機樣式時右側會短暫出現的空白 */
/* 限制右滑 */
html, body {
    overflow-x: hidden;
}

/* 全域樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: 55px; /* 根據 .desktop-nav 實際高度調整 */
}

/* 英文版 desktop-nav 在寬度 < 1390px 時會變兩行 */
@media (max-width: 1389.98px) {
    body:lang(en) {
        padding-top: 128px;
    }
}

/* 頂部工具列 */
@media (max-width: 400px) {
    .top-toolbar > div > div > div {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* 伺服器選擇器 */
.server-selector {
    border-bottom: 1px solid var(--border-gray);
}

/* 英雄區塊 */
.hero-section {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
}

/* 卡片懸停效果 */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-light);
}

/* 內容區域 */
.content-body {
    line-height: 1.8;
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

/* 下載區域 */
.download-section {
    border: 2px dashed var(--border-accent-green);
    background-color: var(--bg-light-gray);
}

/* 會員專屬標籤 */
.badge {
    font-size: 0.75em;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0 !important;
    }

    .display-4 {
        font-size: 2rem;
    }

    .display-3 {
        font-size: 2.5rem;
    }
}

/* 載入動畫 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 麵包屑樣式 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
}

/* 表單樣式 */
.form-control:focus {
    border-color: var(--border-focus-blue);
    box-shadow: 0 0 0 0.2rem var(--shadow-focus-blue);
}

/* 導航欄樣式 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    /* 以下避免文字超出寬度並使按鈕不換行 */
    max-width: calc(100% - 64px);
    white-space: nowrap; /* 防止文字換行 */
    overflow: hidden; /* 隱藏超出文字 */
    text-overflow: ellipsis; /* 超出時顯示省略號 */
}

/* 頁腳樣式 */
footer {
    margin-top: auto;
}

/* ****
navigation bar
start from
*/
.menu-toggle {
    font-size: 1.2rem;
}

.mobile-nav {
    display: none;
    background-color: #f8f9fa;
    padding: 1rem;
}

.mobile-nav ul > li {
    margin-bottom: 0.8rem;
}

.mobile-nav ul > li > span {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-gray);
}

.mobile-nav ul ul {
    padding-left: 1rem;
}

.mobile-nav ul ul li a {
    text-decoration: none;
    color: var(--link-blue);
    display: block;
    margin-bottom: 0.3rem;
}

.desktop-nav .nav-link {
    color: var(--text-dark);
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.desktop-nav .dropdown-menu {
    border-radius: 0.25rem;
    box-shadow: 0 4px 12px var(--shadow-light);
}

.desktop-nav .dropdown-menu-custom {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-white);
    border-top: 3px solid var(--border-accent-green);
    box-shadow: 0 4px 12px var(--shadow-medium);
    z-index: 1100;
    padding: 1.5rem 0;
}

/* 滑過 dropdown 就展開 */
.desktop-nav .dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0; /* 避免跳動 */
}

/* 響應式切換 desktop / mobile 選單 */
@media (max-width: 991.98px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-nav {
        display: block;
    }

    .menu-toggle {
        display: block;
    }

    /* mobile 選單時 body 無需 padding */
    body, body:lang(en) {
        padding-top: 0;
    }
}

/* 桌機版：隱藏漢堡按鈕 */
@media (min-width: 992px) {
    .mobile-nav {
        display: none !important;
    }

    .menu-toggle {
        display: none;
    }
}

/* ========== 手機版 Drawer 導覽 ========== */

/* 整個遮罩容器 */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    z-index: 1055;
    background-color: rgba(0, 0, 0, 0); /* 初始透明 */
    transition: background-color 0.3s ease;
}

/* 顯示背景遮罩 */
.mobile-nav-overlay.show {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Drawer 本體（左側主選單） */
.mobile-drawer {
    width: 80vw;
    height: 100vh;
    background-color: var(--bg-white);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 1056;
}

/* 顯示 Drawer */
.mobile-drawer.slide-in {
    transform: translateX(0);
}

/* 空白區點擊關閉 */
.drawer-backdrop {
    width: 20vw;
    cursor: pointer;
}

/* 子選單區塊 */
.submenu {
    transition: opacity 0.3s ease-in-out;
}

/* 主選單項目 */
#mainMenu button {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light-gray);
}

/* 子選單標題列（含返回與叉叉） */
.submenu .d-flex {
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 0.5rem;
}

/* 子選單中的返回按鈕與標籤 */
.submenu .btn-link {
    color: var(--text-gray);
    text-decoration: none;
}

/* 子選單中選單項目 */
.submenu ul li a {
    color: var(--text-gray);
    padding: 0.5rem 0;
    display: block;
    border-bottom: 1px dashed var(--border-gray);
}

/* ========== 電腦版 Nav ========== */
/*
.desktop-nav {
    position: relative;
    border-top: 1px solid var(--border-gray);
    background-color: var(--bg-white);
    z-index: 100; /* 保證高於其他內容
    width: 100%;
}*/

.desktop-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 1000;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    box-shadow: 0 2px 8px var(--shadow-light);
}

.nav.w-100 > .nav-item {
    flex: 1 1 0;
    position: relative;
}

.nav.w-100 > .nav-item > .nav-link {
    display: block;
    width: 100%;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    padding: 1rem 0.5rem;
    color: var(--text-dark);

}

.nav.w-100 > .nav-item > .nav-link:hover {
    color: var(--link-green);
}

/* 子選單區塊 首頁用*/
.nav-item .dropdown-menu-custom {
    display: none;
    position: fixed; /* 全螢幕寬度對齊 */
    top: 50px; /* 依據 navbar 實際高度微調 */
    left: 0;
    width: 100vw;
    background-color: var(--bg-white);
    z-index: 999;
    padding: 2rem 0;
    border-top: 3px solid var(--border-accent-green);
    box-shadow: 0 2px 8px var(--shadow-light);
}

/* hover 顯示 dropdown */
.nav-item:hover .dropdown-menu-custom {
    display: block;
}

/* 內部內容最大寬度限制 */
.dropdown-menu-custom .row {
    margin: 0 auto;
    max-width: 1140px;
    padding: 0 3rem;
    box-sizing: border-box;
}

/* 欄位與內距 */
.dropdown-menu-custom .col-md-4 {
    padding: 0 1rem;
}

/* 子標題樣式 */
.dropdown-subtitle {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-accent-green);
    border-left: 4px solid var(--border-accent-green);
    padding-left: 0.5rem;
    margin-bottom: 0.75rem;
}

/* 項目 hover 效果 */
.dropdown-item {
    color: var(--text-dark);
    text-decoration: none;
    padding: 0.25rem 0;
    display: block;
}

.dropdown-item:hover {
    background-color: var(--bg-hover-gray);
    color: var(--text-dark);
}

/* ========== Global 控制 ========== */

/* Drawer 打開時防止背景滾動 */
body.menu-open {
    overflow: hidden;
}

ul[id^="subsubmenu-"] {
    transition: all 0.3s ease;
}


/* ****
navigation bar
end
*/

/*
message
*/
/* Chat widget */
.chat-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-primary-blue);
    color: var(--text-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px var(--shadow-dark);
    z-index: 1050;
}

.chat-fab i {
    font-size: 20px;
}

.chat-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 340px;
    max-height: 70vh;
    background: var(--bg-white);;
    border: 1px solid var(--border-light-gray);
    border-radius: 12px;
    box-shadow: 0 12px 24px var(--shadow-medium);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1050;
}

.chat-panel.show {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary-blue);
    color: var(--text-white);
}

.chat-header .title {
    font-weight: 600;
}

.btn-close-panel {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.chat-messages {
    padding: 12px;
    overflow: auto;
    flex: 1;
    background: var(--bg-light-gray);
}

.msg {
    display: flex;
    margin-bottom: 10px;
    flex-direction: column;
}

.msg.user {
    justify-content: flex-end;
    align-items: flex-end;
}

.msg.agent {
    justify-content: flex-start;
    align-items: flex-start;
}

.bubble {
    max-width: 75%;
    padding: 10px 12px;
    border-radius: 10px;
    position: relative;
    background: var(--bg-agent-bubble);
}

.msg.user .bubble {
    background: var(--bg-user-bubble);
}

.msg.user .bubble-danger {
    background: var(--bg-error-bubble);
    color: var(--text-error);
}

.time {
    display: block;
    font-size: 11px;
    color: var(--text-time-gray);
    margin-top: 4px;
    text-align: right;
}

.chat-input {
    padding: 10px;
    border-top: 1px solid var(--border-light-gray);
    background: var(--bg-white);;
    display: flex;
}

.chat-input form {
    display: flex;
    width: 100%;
}

.chat-input .form-control {
    flex: 1;
}

.chat-fab.notify::after {
    content: "NEW!" attr(data-badge); /* 先寫 NEW! 再接數字 */
    position: absolute;
    top: -6px;
    right: -6px;
    height: 24px;
    padding: 0 8px;
    background: var(--bg-notification-red);
    color: var(--text-white);
    font-size: 12px;
    line-height: 24px;
    border-radius: 6px; /* 小圓角 → 膠囊感 */
    text-align: center;
    font-weight: 700;
    white-space: nowrap; /* 防止換行 */
    box-shadow: 0 0 0 0 var(--shadow-pulse);
    animation: pulse 1.5s infinite;
}


/* 當數量太大時只顯示紅點 */
.chat-fab.notify[data-badge=""]::after,
.chat-fab.notify[data-badge="0"]::after {
    content: "";
    width: 12px;
    min-width: 12px;
    height: 12px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--shadow-pulse);
    }
    70% {
        box-shadow: 0 0 0 10px var(--shadow-pulse-end);
    }
    100% {
        box-shadow: 0 0 0 0 var(--shadow-pulse-end);
    }
}



svg.w-5.h-5 {
  display: none !important;
}


/* —— Tabs 樣式 —— */
.tab-switch .tab-btn{
    appearance: none; background: none; border: 0; padding: 0 6px 8px;
    font-weight: 800; font-size: 1.75rem; position: relative; color: #222;
}
.tab-switch .tab-btn::after{
    content:""; position:absolute; left:0; bottom:-1px; height:3px; width:0; background:#39b39d; transition:width .2s ease;
}
.tab-switch .tab-btn.active::after{ width:110px; }
.tab-pane-custom{ display:none; }
.tab-pane-custom.show{ display:block; }

/* —— 課程安排 —— */
.timeline{ list-style:none; margin:0; padding:0; position:relative; }
.timeline li{ position:relative; padding-left:56px; margin:18px 0; }
.timeline li::before{
    content:""; position:absolute; left:22px; top:-18px; bottom:-18px; width:2px;
    background:repeating-linear-gradient(to bottom,#d1d5db,#d1d5db 6px,transparent 6px,transparent 12px);
}
.timeline li::after{
    content:""; position:absolute; left:12px; top:6px; width:20px; height:20px; border-radius:50%;
    background:#fff; border:2px solid #d1d5db;
}
.timeline .pill{
    display:inline-block; width:100%; background:#e5e7eb; color:#333; padding:10px 18px;
    border-radius:999px; box-shadow:inset 0 0 0 1px rgba(0,0,0,.04); text-align:center;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

@media (max-width: 991.98px){
    .tab-switch .tab-btn{ font-size:1.5rem; }
    .timeline li{ padding-left:48px; }
}