/* --- 基礎設定 --- */
body {
    padding-top: 0; 
    background-color: #f9fafb;
    color: #111827;
    font-family: system-ui, -apple-system, sans-serif;
}

/* 強制利用完整空間：覆蓋 Tailwind 預設的 container 寬度 */
.container {
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

/* 導覽列固定 */
.nav-fixed {
    position: sticky; 
    top: 0;
    width: 100%;
    z-index: 50;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    /* 確保固定標頭的陰影不會被下方的深藍色蓋住 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo-img { height: 50px; width: auto; object-fit: contain; display: block; }
.store-img { height: 35px; width: auto; max-width: 100px; object-fit: contain; }

.lang-btn {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    background-color: #1d4ed8;
    color: white;
    border: none;
    transition: 0.2s;
}

/* --- 導覽列容器 --- */
.nav-bar-bg { 
    background-color: #154f9c; 
    position: relative;
    width: 100%;
}

/* 導覽列表基礎 */
#main-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
    padding: 0 15px;
    justify-content: flex-start; /* 手機版靠左 */
}

/* 【關鍵修改】電腦版切換：置中 */
@media (min-width: 768px) {
    #main-nav {
        justify-content: center;
        overflow-x: hidden; /* 電腦版通常不需要滾動 */
        padding: 0;
    }
}

/* 隱藏捲動條 */
#main-nav::-webkit-scrollbar { display: none; }

/* --- 導覽項目核心樣式 (手機與電腦通用) --- */
.nav-item {
    position: relative; 
    color: rgba(255, 255, 255, 0.75);
    font-weight: 700;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
    padding: 8px 16px; /* 手機版間距 */
}

/* 【關鍵：將發光底線移至此處，手機版即可看見】 */
.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0; 
    height: 3px;
    background: #60a5fa; 
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.8); 
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

/* 滑鼠懸停與選中狀態 (通用) */
.nav-item:hover, .nav-item.active {
    color: #ffffff;
}

/* 選中或懸停時，底線伸展 (通用) */
.nav-item:hover::after,
.nav-item.active::after {
    width: 70%; 
}

.nav-item.active {
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* --- 電腦版專用微調 --- */
@media (min-width: 768px) {
    .nav-item {
        padding: 16px 24px;  /* 電腦版高度較高 */
        font-size: 1.05rem;
        letter-spacing: 0.05em;
    }

    .nav-item:hover {
        background-color: rgba(255, 255, 255, 0.05); 
    }
}
/* --- 手機版右側漸層 --- */
@media (max-width: 767px) {
    .nav-bar-bg::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to right, transparent, #154f9c); 
        pointer-events: none;
        z-index: 5;
    }
}

/* 讓 YouTube 影片寬度自適應容器 */
.youtube-container iframe {
    max-width: 100%;
    width: 100% !important;
    border-radius: 12px;
    shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* --- 產品資料卡 (Category Card) 樣式 --- */
.category-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.category-img-container {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f9fafb;
}

.category-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 自定義表格樣式 (緊湊精準版) --- */
.custom-data-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d1d5db;
    background-color: white;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.custom-data-table th,
.custom-data-table td {
    border: 1px solid #d1d5db;
    padding: 6px 6px;
    text-align: left;
    vertical-align: middle;
}

.custom-data-table thead th {
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 700;
}

.custom-data-table td.no-border-cell {
    border-top: none;
    border-bottom: none;
}

.custom-data-table tr:last-child td {
    border-bottom: 1px solid #d1d5db;
}

/* --- 圖片 Grid 系統 --- */
.image-grid-container {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .image-grid-container {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

.home-bottom-image {
    width: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

p { 
    white-space: pre-line; 
    line-height: 1.4; 
    margin-bottom: 0.5rem; 
}

/* 內容區圖片容器 */
.content-image-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.content-image-wrapper img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.content-image-wrapper img:hover {
    transform: scale(1.01);
}

/* --- 商品內頁 1:2 佈局樣式 --- */
.product-layout-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .product-layout-container {
        flex-direction: row;
        align-items: flex-start;
    }
    .product-image-side {
        flex: 1; /* 1份 */
        position: sticky;
        top: 100px;
    }
    .product-info-side {
        flex: 2; /* 2份 (1:2) */
    }
}

.detail-main-img {
    width: 100%;
    max-width: 500px; /* 限制最大寬度避免過大 */
    margin: 0 auto;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    position: relative;
}

.marquee-content {
    display: inline-flex;
    gap: 1.5rem;
    padding-left: 1.5rem;
}

.animate-scroll-left {
    animation: scroll-left 40s linear infinite;
}

.animate-scroll-right {
    animation: scroll-right 40s linear infinite;
}

.marquee-container:hover .marquee-content {
    animation-play-state: paused;
}

/* 取消特定走馬燈的滑鼠暫停效果 */
.no-pause:hover .marquee-content {
    animation-play-state: running !important;
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes scroll-right {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

/* YouTube 響應式容器 */
.youtube-container {
    position: relative;
    width: 100%;
    /* 使用 aspect-ratio 是現代網頁最簡單的方法 */
    aspect-ratio: 16 / 9; 
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* 針對手機版的特別微調：如果覺得 16:9 在手機還是太佔空間，可以微調比例 */
@media (max-width: 768px) {
    .youtube-container {
        aspect-ratio: 16 / 10; /* 手機版稍微扁一點點 */
    }
}

@media (max-width: 767px) {
    /* 修正首頁內容區塊的頂部間距 */
    #app {
        padding-top: 0.5rem !important;
    }

    /* 修正公司名稱標題的大小與行高 */
    #app h2 {
        font-size: 1.1rem !important; /* 再次微調字體 */
        line-height: 1.1 !important;
        margin-top: 0 !important;
        margin-bottom: 2px !important;
    }

    #app h3 {
        font-size: 0.8rem !important;
        line-height: 1.1 !important;
        margin-top: 0 !important;
    }
}
