/* /admin/assets/css/style.css */

/* ==========================================
   1. 基礎重置與修正
   ========================================== */
html, body {
    overflow-x: hidden;
}

/* ==========================================
   2. 全域 CSS 變數定義 (預設淺色主題)
   ========================================== */
:root {
    --bg-main: #fdfdfd;           
    --text-main: #333333;         
    --text-muted: #64748b;        
    --card-bg: #ffffff;           
    --card-border: #e2e8f0;       
    --card-shadow: rgba(0, 0, 0, 0.04);       
    --card-shadow-hover: rgba(0, 0, 0, 0.12); 
    --card-hover-border: #cbd5e1; 
    --card-title: #1e293b;        
    --card-title-hover: #2563eb;  
    --crumb-bg: #f8fafc;          
    --crumb-border: #edf2f7;      
    --crumb-text: #718096;        
    --crumb-link: #4a5568;        
    --border-divider: #e2e8f0;    
    --empty-box-bg: #f8fafc;      
    --empty-box-border: #cbd5e1;  

    /* Navbar 亮色白底配置 */
    --navbar-bg: #ffffff;         
    --navbar-text: #334155;       
    --navbar-hover: #f1f5f9;      
    --dropdown-bg: #ffffff;       
    --dropdown-text: #475569;     
    --dropdown-hover: #f8fafc;    
    --dropdown-hover-text: #2563eb;

    /* Footer 亮色系配置 (與 Navbar 呼應) */
    --footer-bg: #f8fafc;         
    --footer-bottom-bg: #f1f5f9;  
    --footer-text: #475569;
    --footer-heading: #1e293b;
    --footer-border: #e2e8f0;
    --footer-link: #64748b;
    --footer-link-hover: #2563eb;
}

/* ==========================================
   3. 深色模式自動適應 (Dark Mode)
   ========================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --card-bg: #1e293b;
        --card-border: #334155;
        --card-shadow: rgba(0, 0, 0, 0.3);
        --card-shadow-hover: rgba(0, 0, 0, 0.5);
        --card-hover-border: #475569;
        --card-title: #f8fafc;
        --card-title-hover: #60a5fa;
        --crumb-bg: #1e293b;
        --crumb-border: #334155;
        --crumb-text: #94a3b8;
        --crumb-link: #cbd5e1;
        --border-divider: #334155;
        --empty-box-bg: #1e293b;
        --empty-box-border: #475569;

        /* Navbar 深色模式配置 */
        --navbar-bg: #1e293b;         
        --navbar-text: #f8fafc;
        --navbar-hover: #334155;
        --dropdown-bg: #1e293b;       
        --dropdown-text: #cbd5e1;
        --dropdown-hover: #0f172a;    
        --dropdown-hover-text: #60a5fa;

        /* Footer 深色模式配置 */
        --footer-bg: #0b1120;         
        --footer-bottom-bg: #030712;
        --footer-text: #94a3b8;
        --footer-heading: #f8fafc;
        --footer-border: #1e293b;
        --footer-link: #cbd5e1;
        --footer-link-hover: #60a5fa;
    }
}

/* ==========================================
   4. 基礎網頁排版 
   ========================================== */
body { 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    background: var(--bg-main); 
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
    transition: background-color 0.3s ease, color 0.3s ease;
}

.page-container { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem; 
    padding: 0 15px 2rem 15px; 
    box-sizing: border-box; 
}

p{line-height: 2.0; }

/* ==========================================
   5. 上方導覽列 (Navbar)
   ========================================== */
.navbar { 
    background: var(--navbar-bg); 
    padding: 0; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    z-index: 10000; 
    transition: transform 0.35s ease-in-out, background-color 0.3s ease; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); 
}

.navbar.navbar-hidden { 
    transform: translateY(-100%); 
}

.nav-container { display: flex; width: 100%; box-sizing: border-box; align-items: center; }
.logo { padding: 10px 20px; display: flex; align-items: center; }
.logo a { text-decoration: none; display: flex; align-items: center; }
.logo img { max-height: 42px; display: block; object-fit: contain; }
.logo-text { font-size: 20px; font-weight: bold; color: var(--navbar-text); transition: color 0.3s ease; }

.logo-dark { display: none !important; }
:root.dark-mode .logo-light.has-dark { display: none !important; }
:root.dark-mode .logo-dark.has-light { display: block !important; }
@media (prefers-color-scheme: dark) {
    :root:not(.light-mode) .logo-light.has-dark { display: none !important; }
    :root:not(.light-mode) .logo-dark.has-light { display: block !important; }
}

.menu-toggle { display: none; color: var(--navbar-text); font-size: 24px; cursor: pointer; padding: 15px 20px; user-select: none; text-align: right; width: 30px; transition: color 0.3s ease; }

.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; }
.nav-menu li { position: relative; }
.nav-menu a { display: block; padding: 15px 20px; color: var(--navbar-text); text-decoration: none; white-space: nowrap; font-weight: 500; transition: background 0.2s, color 0.2s; }
.nav-menu a:hover { background: var(--navbar-hover); color: var(--dropdown-hover-text); }

.dropdown { display: none; position: absolute; top: 100%; left: 0; background: var(--dropdown-bg); min-width: 190px; list-style: none; padding: 0; margin: 0; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border: 1px solid var(--border-divider); border-top: none; transition: background-color 0.3s ease; border-radius: 0 0 6px 6px; overflow: hidden; }
.dropdown a { padding: 12px 20px; font-size: 14px; color: var(--dropdown-text); transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease; border-bottom: 1px solid var(--border-divider); }
.dropdown a:last-child { border-bottom: none; }
.dropdown a:hover, .dropdown li:hover > a { background: var(--dropdown-hover) !important; color: var(--dropdown-hover-text) !important; padding-left: 24px; }

.nav-menu li.active > a, .nav-menu a.active { background: var(--navbar-hover) !important; color: var(--dropdown-hover-text) !important; font-weight: bold; }
.dropdown li.active > a { background: var(--dropdown-hover) !important; color: var(--dropdown-hover-text) !important; font-weight: bold; }

@media (min-width: 768px) { 
    .nav-menu li:hover > .dropdown { display: block; } 
    .dropdown .dropdown { top: 0; left: 100%; border-top: 1px solid var(--border-divider); border-radius: 6px; }
    .nav-align-right .nav-menu > li:last-child .dropdown, .nav-align-right .nav-menu > li:nth-last-child(2) .dropdown, .nav-align-right .dropdown { left: auto; right: 0; }
    .nav-align-right .dropdown .dropdown { top: 0; left: auto; right: 100%; }
}

@media (max-width: 767px) {
    .nav-container { flex-direction: row !important; flex-wrap: wrap; justify-content: space-between !important; align-items: center; padding: 0 !important; }
    .logo { flex: 1; order: 1; } 
    .menu-toggle { display: block; order: 2; }
    .nav-menu { display: none !important; flex-direction: column; width: 100%; border-top: 1px solid var(--border-divider) !important; order: 3; } 
    .nav-menu.active { display: flex !important; }
    .nav-menu li { width: 100%; } 
    .dropdown { position: static; width: 100%; box-shadow: none; background: var(--navbar-bg); border: none; border-radius: 0; }
    .dropdown .dropdown { position: static; background: var(--navbar-hover); border: none; } 
    .nav-menu li.open > .dropdown { display: block; }
}

/* ==========================================
   6. 標籤頁 (Tab Bar) UI 獨立樣式
   ========================================== */
.tab-bar {
    width: 100vw;
    background: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    box-sizing: border-box;
    position: fixed; 
    z-index: 9999;
    transition: top 0.35s ease-in-out; 
}

.tab-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center; 
    max-width: 1200px;
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
}

.tab-parent-title {
    font-weight: 600;
    color: #ffffff; 
    margin-right: 12px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.tab-separator {
    color: #94a3b8; 
    margin-left: 12px;
    opacity: 0.5;
    user-select: none;
}

.tab-links {
    display: flex;
    justify-content: center; 
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none; 
}
.tab-links::-webkit-scrollbar { display: none; }
.tab-links a {
    color: #cbd5e1; 
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 13px 15px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.tab-links a:hover { color: #60a5fa; } 
.tab-links a.active { color: #60a5fa; border-bottom-color: #60a5fa; }

.tab-mobile-container { display: none; width: 100%; position: relative; }
.tab-mobile-toggle {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; padding: 13px 0; font-size: 14px; font-weight: 500; 
    color: #60a5fa; cursor: pointer; user-select: none;
}
.tab-mobile-dropdown {
    display: none; flex-direction: column; position: absolute;
    top: 100%; left: -15px; width: 100vw; background: rgba(0, 0, 0, 0.95);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); z-index: 10001;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}
.tab-mobile-dropdown.show { display: flex; }
.tab-mobile-dropdown a {
    padding: 14px 20px; border-bottom: 1px solid #333;
    text-decoration: none; color: #cbd5e1; font-size: 14px;
}
.tab-mobile-dropdown a:last-child { border-bottom: none; }

@media (max-width: 767px) {
    .tab-bar-inner { justify-content: flex-start; }
    .tab-links { display: none; }
    .tab-mobile-container { display: block; }
}

/* ==========================================
   7. 麵包屑導航 (Breadcrumb) 雙切換控制
   ========================================== */
.breadcrumb-desktop { display: block; }
.breadcrumb-mobile { display: none; }

.breadcrumb-nav { width: 100%; margin-bottom: -0.5rem; }
.breadcrumb-list { list-style: none; padding: 10px 15px; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.breadcrumb-list li { display: flex; align-items: center; color: var(--crumb-text); }
.breadcrumb-list li a { color: var(--crumb-link); text-decoration: none; transition: color 0.2s; }
.breadcrumb-list li a:hover { color: #3b82f6; text-decoration: underline; }
.breadcrumb-list li.active { color: var(--text-main); font-weight: bold; }
.breadcrumb-separator { color: var(--text-muted); margin-left: 8px; user-select: none; }

@media (max-width: 767px) {
    .breadcrumb-desktop { display: none; }
    .breadcrumb-mobile { 
        display: block; 
        width: 100%; 
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 15px 1.5rem 15px; 
        box-sizing: border-box; 
    }
    .breadcrumb-mobile .breadcrumb-nav { margin-bottom: 0; }
}

/* ==========================================
   8. 輪播圖套件 (Swiper) 樣式
   ========================================== */
.swiper-slide { position: relative; overflow: hidden; border-radius: 6px; }
.swiper-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swiper-slide-title { position: absolute; bottom: 0; left: 0; width: 100%; padding: 12px 15px; background: linear-gradient(to top, rgba(0,0,0,0.85), transparent); color: #fff; font-size: 15px; text-decoration: none; box-sizing: border-box; }
.swiper-button-next, .swiper-button-prev { color: #fff !important; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.swiper-pagination-bullet-active { background: #3498db !important; }

/* ==========================================
   9. 商品系列總覽與分類呈現
   ========================================== */
.series-section-group { margin-bottom: 50px; padding-bottom: 30px; border-bottom: 1px solid var(--border-divider); transition: border-color 0.3s; }
.series-section-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.series-section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; border-left: 4px solid #3b82f6; padding-left: 12px; }
.series-section-header h2 { margin: 0; font-size: 22px; color: var(--text-main); }
.series-section-header p { margin: 5px 0 0 0; font-size: 14px; color: var(--text-muted); }
.series-view-more-btn { font-size: 13px; color: #3b82f6; text-decoration: none; font-weight: 500; white-space: nowrap; transition: color 0.2s; }
.series-view-more-btn:hover { color: #60a5fa; text-decoration: underline; }

.category-wrapper { max-width: 1200px; margin: 0 auto; padding: 0 15px; box-sizing: border-box; width: 100%; }
.category-header { border-bottom: 2px solid var(--border-divider); padding-bottom: 12px; margin-bottom: 25px; transition: border-color 0.3s; }
.category-header h1 { margin: 0; font-size: 28px; color: var(--text-main); font-weight: 700; }
.category-header p { color: var(--text-muted); margin: 8px 0 0; font-size: 15px; line-height: 1.6; }

.cat-grid-container { display: grid; gap: 25px; list-style: none; padding: 0; margin: 0; }
.cat-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cat-card { background: var(--card-bg); border-radius: 10px; overflow: hidden; border: 1px solid var(--card-border); box-shadow: 0 2px 8px var(--card-shadow); transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.3s; display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; }
.cat-card:hover { transform: translateY(-6px); box-shadow: 0 12px 24px var(--card-shadow-hover); border-color: var(--card-hover-border); }

/* 🌟 卡片圖片比例設定為 2:1 */
.cat-card-img-wrap { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: rgba(0, 0, 0, 0.05); position: relative; }

.cat-card-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.cat-card:hover .cat-card-img { transform: scale(1.05); } 
.cat-card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 32px; background: var(--crumb-bg); }

.cat-card-body { padding: .75rem; display: flex; flex-direction: column; flex: 1; }
.cat-card-title { margin: 0 0 0 0; font-size: 18px; color: var(--card-title); font-weight: 600; line-height: 1.4; transition: color 0.2s; }
.cat-card:hover .cat-card-title { color: var(--card-title-hover); }
.cat-card-desc { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.6; flex: 1; }

@media (max-width: 767px) {
    .cat-grid-2, .cat-grid-3, .cat-grid-4 { grid-template-columns: 1fr !important; gap: 18px !important; }
}

/* ==========================================
   10. 積木排版區塊與全螢幕滿版
   ========================================== */
.block-wrapper { box-sizing: border-box; position: relative; overflow: hidden; min-width: 0; max-width: 100%; }
.block-wrapper.is-full-width { width: 100vw !important; max-width: 100vw !important; position: relative !important; left: 50% !important; right: 50% !important; margin-left: -50vw !important; margin-right: -50vw !important; padding-left: 0 !important; padding-right: 0 !important; box-sizing: border-box !important; }
.block-wrapper.is-full-width img { border-radius: 0 !important; width: 100% !important; }
.block-wrapper.is-full-width .swiper-slide { border-radius: 0 !important; }
.block-wrapper.is-full-width .youtube-container, .block-wrapper.is-full-width iframe { border-radius: 0 !important; }

/* ==========================================
   11. 積木內部元件樣式 (支援動態比例升級版)
   ========================================== */
.gallery-grid { display: grid; list-style: none; padding: 0; margin: 0; }

.gallery-grid img { 
    width: 100%; 
    aspect-ratio: var(--gallery-ratio, 4 / 3); 
    object-fit: cover; 
    display: block; 
    border-radius: inherit; 
}

/* 🌟 加入這段：強制覆蓋行內樣式，手機版自動優化排版 */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* 強制變為 3 欄 */
        gap: 8px !important; /* 手機版稍微縮小間距，畫面會更精緻 */
    }
}
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr)  !important; /* 若遇到特別窄的舊手機，自動降為 3 欄防呆 */
    }
}

/* 🌟 輪播：新增 Swiper 的動態比例控制 */
.frontend-swiper .swiper-slide, 
.swiper-slider-block .swiper-slide { width: 100%;aspect-ratio: var(--slider-ratio, 16 / 9); overflow: hidden;
}

.youtube-container { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.youtube-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* ==========================================
   12. 最新消息清單與分頁
   ========================================== */
.news-list-container { display: flex; flex-direction: column; gap: 0; border-top: 2px solid var(--border-divider); }
.news-list-item { display: flex; align-items: center; padding: 18px 10px; border-bottom: 1px solid var(--border-divider); text-decoration: none; color: var(--text-main); transition: background-color 0.2s ease, padding-left 0.2s ease; }
.news-list-item:hover { background-color: var(--crumb-bg); padding-left: 15px; }
.news-date { width: 110px; font-size: 14px; color: var(--text-muted); font-family: monospace; flex-shrink: 0; }
.news-title { font-size: 16px; font-weight: 500; line-height: 1.5; transition: color 0.2s; flex: 1; }
.news-list-item:hover .news-title { color: #3b82f6; }
@media (max-width: 767px) {
    .news-list-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .news-date { width: 100%; font-size: 13px; }
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; justify-content: center; align-items: center; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border-divider); border-radius: 6px; background: var(--card-bg); color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; transition: all 0.2s; box-sizing: border-box; }
.pagination a:hover { border-color: #3b82f6; color: #3b82f6; }
.pagination a.active { background: #3b82f6; color: #ffffff; border-color: #3b82f6; cursor: default; }
.pagination span.disabled { opacity: 0.5; cursor: not-allowed; background: transparent; }

/* ==========================================
   13. 結構化頁尾 (Footer) 與 社群連結
   ========================================== */
.site-footer { 
    background: var(--footer-bg); 
    color: var(--footer-text); 
    padding-top: 45px; 
    font-size: 14px; 
    margin-top: auto; 
    border-top: 4px solid #3b82f6; 
    transition: background-color 0.3s ease; 
}
.footer-container { max-width: 1200px; margin: 0 auto; padding: 0 20px 35px 20px; display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 40px; box-sizing: border-box; }

.footer-col h4 { 
    color: var(--footer-heading); 
    font-size: 16px; 
    margin: 0 0 15px 0; 
    position: relative; 
    padding-bottom: 8px; 
}
.footer-col h4::after { content: ''; position: absolute; bottom: 0; left: 0; width: 35px; height: 2px; background: #3b82f6; }

.footer-brand p { 
    line-height: 1.6; 
    margin: 12px 0 0 0; 
    color: var(--footer-text); 
    max-width: 360px; 
}

.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { 
    color: var(--footer-link); 
    text-decoration: none; 
    transition: color 0.2s, padding-left 0.2s; 
    display: inline-block; 
}
.footer-links a:hover { 
    color: var(--footer-link-hover); 
    padding-left: 5px; 
}

.footer-contact p { 
    margin: 0 0 10px 0; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    color: var(--footer-text); 
}

.footer-bottom { 
    background: var(--footer-bottom-bg); 
    padding: 18px 20px; 
    border-top: 1px solid var(--footer-border); 
    transition: background-color 0.3s ease; 
}

.footer-bottom-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 10px; 
    font-size: 13px; 
    color: var(--footer-text); 
}
.footer-bottom-container-left { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.footer-social-icons { display: flex; align-items: center; gap: 14px; }
.footer-social-icons a { 
    color: var(--footer-link); 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 22px; 
    height: 22px; 
    transition: color 0.3s ease, transform 0.3s ease; 
    text-decoration: none; 
    margin: 0 !important; 
    padding: 0 !important; 
}
.footer-social-icons a:hover { transform: translateY(-3px); }
.footer-social-icons a.soc-fb:hover { color: #1877F2; }
.footer-social-icons a.soc-ig:hover { color: #E4405F; }
.footer-social-icons a.soc-line:hover { color: #00C300; }
.footer-social-icons a.soc-yt:hover { color: #FF0000; }
.footer-social-icons svg { width: 100%; height: 100%; fill: currentColor; }

.footer-bottom a { 
    color: var(--footer-link); 
    text-decoration: none; 
    margin-left: 15px; 
}
.footer-bottom a:hover { 
    color: var(--footer-link-hover); 
}

@media (max-width: 768px) {
    .footer-container { grid-template-columns: 1fr; gap: 30px; }
    .footer-bottom-container { flex-direction: column; text-align: center; }
    .footer-bottom-container-left { justify-content: center; flex-direction: column; gap: 10px; }
    .footer-bottom a { margin: 0 8px; }
}

/* 🌟 GLightbox 燈箱樣式覆蓋：修復放大偏移、設定最大比例、文字居中 */
.glightbox-container { z-index: 10002 !important; } /* 🌟 將燈箱圖層拉到最高，避免被預覽視窗遮擋 */
.gslide-image:not(.zoomed) img { max-width: 90vw !important; max-height: 90vh !important; }
.gslide-image img { border-radius: 8px; }
.glightbox-clean .gslide-description { background: transparent !important; text-align: center !important; }
.glightbox-clean .gdesc-inner { background: transparent !important; padding: 15px 0 !important; }
.glightbox-clean .gslide-title { display: none !important; }
.glightbox-clean .gslide-desc { color: #ffffff !important; text-shadow: 0 2px 8px rgba(0,0,0,0.8) !important; font-size: 16px !important; line-height: 1.6 !important; margin: 0 !important; text-align: center !important; font-weight: 500 !important; }
