/* ==================================================
   1. 網站基礎變數與設定
   ================================================== */
:root {
    --primary-blue: #0056b3;
    --secondary-green: #28a745;
    --light-bg: #f8f9fa;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Microsoft JhengHei';
    color: #333;
    line-height: 1.6;
}

/* ==================================================
   2. 頂部導覽列 (Navbar) & 特效
   ================================================== */
.navbar-custom {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-custom .nav-link {
    color: #333;
    font-weight: 500;
    margin-right: 15px;
    transition: color 0.3s;
}

.navbar-custom .nav-link:hover {
    color: var(--primary-blue);
}

/* 毛玻璃效果與基礎過渡 */
.navbar-glass {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

/* 滾動後的緊湊狀態與立體陰影 */
.navbar-glass.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* LOGO 平滑縮放動畫 */
.navbar-brand img {
    transition: all 0.4s ease;
}

.navbar-glass.scrolled .navbar-brand img {
    max-height: 40px !important;
    /* 滾動後縮小 */
}

/* 選單文字懸停底線動畫 */
.nav-item-hover .nav-link {
    position: relative;
    font-weight: 500;
    color: #4a5568 !important;
    transition: color 0.3s ease;
    margin: 0 0.5rem;
}

.nav-item-hover .nav-link:hover {
    color: var(--primary-blue, #0056b3) !important;
}

.nav-item-hover .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--primary-blue, #0056b3);
    transition: all 0.3s ease-out;
    transform: translateX(-50%);
}

.nav-item-hover .nav-link:hover::after {
    width: 80%;
}

/* 隱藏 Bootstrap 預設的下拉三角形，解決與底線特效的衝突 */
.dropdown-toggle::after {
    display: none !important;
}

/* 下拉選單美化與懸停展開特效 */
.dropdown-menu-custom {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-menu-custom .dropdown-item {
    transition: all 0.3s ease;
    color: #4a5568;
    font-weight: 500;
}

.dropdown-menu-custom .dropdown-item:hover {
    background-color: rgba(0, 86, 179, 0.08);
    color: var(--primary-blue, #0056b3);
    padding-left: 1.5rem;
    /* 滑鼠移入時文字向右微動 */
}

/* 響應式展開與動畫特效 */
@media (min-width: 992px) {
    .nav-item.dropdown:hover .dropdown-menu {
        display: block;
        animation: fadeDown 0.3s ease forwards;
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================================================
   3. 產品列表 & 產品詳細頁 (Products & ProductDetail)
   ================================================== */
/* 產品卡片懸停效果 */
.product-card {
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
    border-radius: 10px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

/* 產品列表的圖片外框 */
.product-img-wrapper {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

/* 產品詳細介紹文字區塊 (防破版設定) */
.product-description {
    line-height: 1.8;
    color: #555;
    font-size: 1.05rem;
    width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

.product-description img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 1rem 0;
}

.product-description table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
}

.product-description td,
.product-description th {
    word-break: break-word;
    padding: 8px;
}

.product-description ul,
.product-description ol {
    padding-left: 1.5rem;
}

/* ==================================================
   4. 關於我們 (About Us) & 時間軸
   ================================================== */
/* ✨ 關於我們：專屬酷炫特效區 ✨ */

/* 背景裝飾幾何圖形光暈 */
.bg-shape-blob {
    position: absolute;
    top: -30px;
    left: -30px;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(13, 110, 253, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    z-index: 0;
    border-radius: 50%;
}

/* 質感微凸標籤懸停特效 */
.value-badge {
    transition: all 0.3s ease;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.value-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(13, 110, 253, 0.1) !important;
    border-color: rgba(13, 110, 253, 0.3);
}

/* 時間軸主容器 */
.timeline-wrapper {
    position: relative;
    padding: 40px 0;
    max-width: 900px;
    margin: auto;
}

/* 中央垂直線 */
.timeline-wrapper::before {
    content: '';
    position: absolute;
    width: 3px;
    background-color: #e9ecef;
    top: 0;
    bottom: 80px;
    left: 50%;
    margin-left: -1.5px;
    z-index: 0;
}

/* 每一年的 Row 設定 */
.timeline-row {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 圓點修正：強制正圓與變色特效 */
.timeline-dot {
    position: absolute;
    left: 50%;
    width: 22px;
    height: 22px;
    background-color: #0d6efd;
    border: 5px solid #fff;
    border-radius: 50%;
    margin-left: -11px;
    z-index: 2;
    box-shadow: 0 0 0 3px #0d6efd;
    transition: all 0.4s ease;
}

.timeline-row:hover .timeline-dot {
    background-color: #198754;
    box-shadow: 0 0 0 5px #198754;
    transform: scale(1.2);
}

/* 未來進行式箭頭 */
.timeline-arrow-container {
    position: relative;
    text-align: center;
    margin-top: 2rem;
}

.timeline-arrow {
    display: inline-flex;
    width: 45px;
    height: 45px;
    background: #0d6efd;
    color: white;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.3);
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

/* 進化版卡片美化 */
.timeline-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #f0f0f0;
    border-left: 6px solid #0d6efd;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 1.8rem;
    border-radius: 16px;
    width: 45%;
}

.timeline-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
    border-left-color: #198754;
}

@media (max-width: 768px) {
    .timeline-wrapper::before {
        left: 20px;
    }

    .timeline-row {
        justify-content: flex-start;
    }

    .timeline-dot {
        left: 20px;
    }

    .timeline-card {
        width: calc(100% - 50px);
        margin-left: 50px;
    }
}

/* ==================================================
   5. 通用元件 & 首頁特效
   ================================================== */
.footer-custom {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
}

.footer-custom a {
    color: #bdc3c7;
    text-decoration: none;
}

.footer-custom a:hover {
    color: white;
}

.text-gradient {
    background: linear-gradient(45deg, #0056b3, #00d2ff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.parallax-section {
    position: relative;
    background: linear-gradient(rgba(0, 30, 80, 0.8), rgba(0, 30, 80, 0.8)), url('/images/banner2.jpg') center/cover fixed;
    color: white;
    padding: 100px 0;
    box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.3);
}

.feature-card {
    transition: all 0.4s ease;
    border-top: 4px solid transparent;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-top: 4px solid var(--primary-blue);
    box-shadow: 0 15px 30px rgba(0, 86, 179, 0.15) !important;
}

.btn-glow {
    animation: glow 2s infinite alternate;
}

.btn-contact-glow {
    background: linear-gradient(45deg, #0056b3, #007bff);
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: white !important;
}

.btn-contact-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 86, 179, 0.3) !important;
    color: white !important;
}

.partner-card {
    background-color: #ffffff;
    border: 1px solid #f0f4f8;
    border-radius: 16px;
    padding: 2rem 1rem;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0.9;
}

.partner-card:hover {
    opacity: 1;
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 86, 179, 0.1);
    border-color: rgba(0, 86, 179, 0.2);
}

.partner-card img {
    transition: transform 0.4s ease;
}

.partner-card:hover img {
    transform: scale(1.05);
}

/* ==================================================
   6. 最新消息 (News) 列表特效
   ================================================== */
.news-list-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05) !important;
}

.news-list-item {
    transition: all 0.3s ease;
    border-left: 4px solid transparent !important;
}

.news-list-item:hover {
    background-color: #f8faff;
    border-left: 4px solid var(--primary-blue) !important;
    transform: translateX(5px);
}

.news-list-item .news-title {
    transition: color 0.3s ease;
}

.news-list-item:hover .news-title {
    color: var(--primary-blue) !important;
}

.news-list-arrow {
    transition: transform 0.3s ease;
}

.news-list-item:hover .news-list-arrow {
    transform: translateX(5px);
    color: var(--primary-blue) !important;
}

/* ==================================================
   7. 產品分類側邊欄 (Products Sidebar Accordion)
   ================================================== */
/* 分類卡片整體外觀 */
.category-sidebar {
    border-radius: 16px;
    overflow: hidden;
    border: none;
    background: #ffffff;
}

/* 全部產品按鈕樣式 */
.all-products-btn {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    font-weight: 600;
    color: #495057;
    text-decoration: none;
    background-color: #ffffff;
    transition: all 0.25s ease;
    border-bottom: 1px solid #f1f3f5;
}

.all-products-btn:hover {
    background-color: rgba(0, 86, 179, 0.04);
    color: var(--primary-blue, #0056b3);
    padding-left: 24px;
}

.all-products-btn.active {
    background-color: var(--primary-blue, #0056b3) !important;
    color: #ffffff !important;
}

/* 第一層：主分類 */
.category-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-weight: 600;
    color: #343a40;
    text-decoration: none;
    background-color: #ffffff;
    transition: all 0.25s ease;
}

.category-menu-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-blue, #0056b3);
    padding-left: 24px;
}

.category-menu-item.active {
    background-color: rgba(0, 86, 179, 0.06);
    color: var(--primary-blue, #0056b3);
    border-left: 4px solid var(--primary-blue, #0056b3);
}

/* 第二層：子分類容器與項目 */
.subcategory-list {
    background-color: #fafbfc;
    border-left: 1px solid #e9ecef;
    margin-left: 20px;
}

.subcategory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 10px 16px;
    font-size: 0.92rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.25s ease;
}

.subcategory-item:hover {
    color: var(--primary-blue, #0056b3);
    background-color: #f1f3f5;
    padding-left: 20px;
}

.subcategory-item.active {
    color: var(--primary-blue, #0056b3);
    font-weight: bold;
    background-color: #eef2f7;
}

/* 第三層：第三級分類容器與項目 */
.childcategory-list {
    background-color: #ffffff;
    border-left: 1px dashed #dee2e6;
    margin-left: 16px;
}

.childcategory-item {
    display: block;
    padding: 8px 20px 8px 16px;
    font-size: 0.85rem;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.25s ease;
}

.childcategory-item:hover {
    color: var(--primary-blue, #0056b3);
    background-color: #f8f9fa;
    padding-left: 20px;
}

.childcategory-item.active {
    color: var(--primary-blue, #0056b3);
    font-weight: bold;
    background-color: rgba(0, 86, 179, 0.04);
}

/* 摺疊旋轉箭頭動畫 */
.collapse-btn {
    border: none;
    background: transparent;
    transition: transform 0.2s ease;
}

.collapse-btn[aria-expanded="true"] .chevron-icon {
    transform: rotate(90deg);
}

.chevron-icon {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: #adb5bd;
}

/* 後台編輯器 (HTML) 內容排版設定 */
.product-description {
    width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

.product-description img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 1rem 0;
}

.product-description table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
}

.product-description td,
.product-description th {
    word-break: break-word;
    padding: 8px;
}

.product-description ul,
.product-description ol {
    padding-left: 1.5rem;
}

/* ✨ 修正 3：全面強化防破版機制，針對表格與圖片進行強制寬度限制 ✨ */
.product-description {
    width: 100%;
    overflow-x: auto;
    /* 如果表格真的太大，允許出現橫向卷軸，絕對不撐破外框 */
    word-wrap: break-word;
    /* 允許長單字換行 */
}

.product-description img {
    max-width: 100% !important;
    /* 強制圖片不能超過容器寬度 */
    height: auto !important;
    border-radius: 8px;
    margin: 1rem 0;
}

.product-description table {
    width: 100% !important;
    /* 強制表格寬度自動符合容器 */
    max-width: 100% !important;
    border-collapse: collapse;
}

.product-description td,
.product-description th {
    word-break: break-word;
    /* 強制表格內的長文字換行 */
    padding: 8px;
    /* 增加表格內的留白讓閱讀更舒適 */
}

.product-description ul,
.product-description ol {
    padding-left: 1.5rem;
}