/* main.css */

/* ========== 全站字體與底色 ========== */
body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #f7f9fc;    /* 統一淡藍底 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
html, body {
    height: 100%;
}
.container.main-content {
    flex: 1;
    padding-top: 4rem;
    padding-bottom: 4rem;
    background-color: #fff;
    border-radius: 12px;
}

/* ========== 標題樣式 ========== */
h2.section-title {
    font-size: 1rem;
    color: #003366;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* ========== 導覽列（NAVBAR） ========== */
.navbar {
    position: fixed;              /* 固定於頁面最上方 */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;                 /* 保證在最上層 */
    background: rgba(34,34,34,0.7);
    backdrop-filter: blur(10px);
    transition: background 0.3s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.navbar.scrolled {
    background-color: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.navbar-brand img {
    height: 40px;
    padding-right: 1rem;
}

/* 導覽列連結 */
.navbar .nav-link {
    color: #fff;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.3rem;
    transition: all 0.3s ease;
}
.nav-link:hover {
    border-bottom: 2px solid orange;
    color: #003366;
    background-color: transparent;
}
.navbar .nav-link:hover {
    color: #FFD700;
    border-bottom: 2px solid transparent;
}
.navbar .nav-link.active {
    color: #FFD700;
    border-bottom: 2px solid #FFD700;
}

/* 語言切換按鈕 */
.language-toggle {
    margin-left: 1rem;
}
.language-toggle .btn {
    color: #fff;
    border: 1px solid #fff;
    background-color: transparent;
    transition: all 0.3s ease;
}
.language-toggle .btn:hover {
    background-color: #FFD700;
    color: #000;
    border-color: #FFD700;
}

/* ========== Banner 輪播 (固定寫法！) ========== */
/* Banner 外層容器，JS 會動態設定 margin-top */
.banner-container {
    margin-top: var(--navbar-height, 64px); /* 跟隨 JS 設定 */
    position: relative;
    z-index: 1; /* 保證在 navbar 之下 */
}

/* 輪播圖片本身 */
.banner-container img,
#mainCarousel img {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    object-fit: cover;
}

/* ========== 下拉選單/產品分類選單 ========== */
.custom-dropdown-menu {
    display: flex;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    z-index: 1000;
    width: 660px;
    justify-content: space-around;
}
.custom-dropdown:hover .custom-dropdown-menu {
    display: flex;
    opacity: 1;
    visibility: visible;
}
.category-block {
    position: relative;
    overflow: hidden;
    width: 180px;
    text-align: center;
}
.category-block.position-relative {
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.category-block:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.15);
}
.category-block img {
    width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.category-image {
    transition: filter 0.3s ease, transform 0.3s ease;
}
.category-block:hover .category-image {
    filter: brightness(40%);
    transform: scale(1.05);
}
.subcategory-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    background-color: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
.category-block:hover .subcategory-overlay {
    opacity: 1;
    visibility: visible;
    background-color: rgba(0, 0, 0, 0.75);
}
.subcategory-overlay a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    margin: 0.3rem 0;
    transition: color 0.2s ease;
}
.subcategory-overlay a:hover {
    color: #ffcc00;
}

/* ========== 產品卡片 ========== */
.product-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0 1rem;
}
.product-card {
    flex: 0 0 auto;
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    background-color: #fff;
    transition: box-shadow 0.3s, transform 0.3s;
    padding: 1rem 1rem 0.5rem;
    box-sizing: border-box;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
}
.product-card a {
    text-decoration: none;
    color: inherit;
    width: 100%;
    text-align: center;
}
.product-card img {
    height: 180px;
    object-fit: contain;
    width: 100%;
    margin-bottom: 0.5rem;
    transition: filter 0.3s ease;
}
.product-card:hover img {
    filter: brightness(80%);
}
.product-name {
    font-weight: bold;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}
.product-card:hover .product-name {
    color: #007bff;
}

/* ========== 區塊間距/自訂內容 ========== */
.container.product-category {
    margin-top: 4rem;
    padding-bottom: 2rem;
}
.container.product-video {
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding-left: 2rem;
    padding-right: 2rem;
}
.container.product-video h2.section-title {
    margin-bottom: 0.75rem;
}
.carousel-item img {
    object-fit: cover;
    object-position: top;
}
.ratio iframe {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.img-fluid.shadow {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}
.img-fluid.rounded {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.about-section { background-color: #f5f7fa; }
.product-video p { font-size: 1rem; }
.footer-visitor-counter {
    text-align: right; font-size: 12px; margin-top: 10px;
}
.product-video-description { font-size: 1rem; }
.section-header { color: #003366; font-size: 1.5rem; }
.card {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
}
.product-demo-title {
    color: #003366;
    font-weight: 600;
    font-size: 1.2rem;
    border-bottom: 2px solid #003366;
    display: inline-block;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}
.product-demo-desc { color: #555; font-weight: 500; }
.video-feature-section { background: linear-gradient(to bottom, #f0f4f8, #ffffff); }
.demo-badge {
    display: inline-block; font-size: 0.85rem; font-weight: 600;
    background: #003366; color: white; padding: 0.3rem 0.75rem;
    border-radius: 20px; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.video-feature-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    max-width: 880px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 51, 102, 0.1);
    transition: box-shadow 0.3s ease;
}
.video-feature-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}
.video-feature-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: #003366;
}
.video-feature-subtitle {
    font-size: 1.1rem;
    color: #555;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}
.video-section { background-color: #f5f7fa; }
.video-section h3 {
    font-size: 1.6rem;
    color: #003366 !important;
}
.video-section p { font-size: 1.05rem; line-height: 1.7; }
.video-section .btn {
    border-radius: 30px; font-weight: 500; border-color: #003366;
    color: #003366; background-color: transparent; transition: all 0.3s ease;
}
.video-section .btn:hover { background-color: #003366; color: #fff; }
.video-section .card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 2.5rem;
    border: 1px solid #e0e4e8;
    box-shadow: none;
}

/* ========== RWD 響應式樣式區塊 ========== */
/* 產品卡片寬度調整 */
@media (max-width: 991px) {
    .product-card { width: 30%; }
}
@media (max-width: 768px) {
    .product-card { width: 48%; }
    .ratio { aspect-ratio: 4 / 3; }
    /* 關閉 hover 選單浮層（手機避免誤觸） */
    .subcategory-overlay,
    .category-block:hover .subcategory-overlay {
        display: none !important;
    }
    .custom-dropdown-menu {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}
@media (max-width: 480px) {
    .product-card { width: 100%; }
}
/* 導覽列選單樣式修正（防止 hover 觸發） */
@media (max-width: 992px) {
    .navbar .nav-link:focus,
    .navbar .nav-link.active {
        color: #fff !important;
        border-bottom: none !important;
    }
}
@media (max-width: 576px) {
    html { font-size: 14px; }
    body { padding-top: 0 !important; }
    .navbar {
        display: flex; align-items: center; justify-content: space-between;
        padding: 0.4rem 1rem;
        background-color: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(12px);
        margin-bottom: 0 !important;
        border-bottom: none !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }
    .navbar-brand { max-width: 65%; flex-shrink: 1; }
    .navbar-brand img {
        max-height: 32px;
        min-width: 90px;
        height: auto;
        width: auto;
    }
    .navbar-toggler {
        margin-left: auto;
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
        border: 1px solid #fff;
        flex-shrink: 0;
    }
    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba%28255, 255, 255, 1%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    }
    .container.main-content {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .section-title { font-size: 1rem; }
    .product-demo-title { font-size: 1.1rem; }
    .product-video-description { font-size: 0.95rem; }

    .banner-container { 
        margin-top: var(--navbar-height, 64px) !important;
        /* 加強保險：不讓被其他樣式蓋掉 */
    }

    .banner-container img {
        display: block;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        object-fit: cover;
    }

    .img-fluid.shadow { box-shadow: none !important; }    
}

@media (max-width: 380px) {
    .navbar-brand img {
        max-height: 24px;
        height: auto;
        width: auto;
        display: block;
    }
}
