/* ============================================================
   導航欄 Header 樣式
   ============================================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(229, 237, 243, 0.6);
    transition: all var(--transition);
}

.site-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* ---------- Logo 區 ---------- */
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-brand img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.brand-sub {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* ---------- 導航選單 ---------- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.header-nav a {
    position: relative;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--color-text-secondary);
    border-radius: 999px;
    transition: all var(--transition);
}

.header-nav a:hover {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.header-nav a.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

/* ---------- 右側 CTA ---------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
}

.header-actions .btn-ghost {
    color: var(--color-text-secondary);
    border-color: var(--color-border);
    background: #fff;
}

/* ============================================================
   合二為一 CTA 按鈕：下載 + 購買
   ============================================================ */
.cta-combo {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 14px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    border-radius: 999px;
    box-shadow:
        0 10px 26px rgba(51, 175, 225, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    overflow: hidden;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.cta-combo:hover {
    transform: translateY(-2px);
    box-shadow:
        0 16px 36px rgba(51, 175, 225, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 微光掃過動畫 */
.cta-combo-shine {
    position: absolute;
    top: 0;
    left: -60%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%);
    transform: skewX(-20deg);
    transition: left 0.7s ease;
    pointer-events: none;
}
.cta-combo:hover .cta-combo-shine { left: 130%; }

/* 雙圖示堆疊組 */
.cta-combo-icons {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.cta-combo-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: #fff;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.cta-combo-icon svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.6;
}
.cta-combo-icon-dl   { top: 2px;  left: 0;  z-index: 1; }
.cta-combo-icon-cart { top: 8px;  left: 10px; z-index: 2; background: #fff; color: var(--color-primary-dark); }
.cta-combo:hover .cta-combo-icon-dl   { transform: translate(-2px, -2px) rotate(-8deg); }
.cta-combo:hover .cta-combo-icon-cart { transform: translate(2px, 2px) rotate(8deg); }

/* 文案 */
.cta-combo-label {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    padding-right: 2px;
}
.cta-combo-main {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.cta-combo-sub {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    opacity: 0.85;
    margin-top: 2px;
}

/* 右側箭頭膠囊 */
.cta-combo-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #fff;
    color: var(--color-primary-dark);
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.cta-combo-arrow svg { width: 14px; height: 14px; }
.cta-combo:hover .cta-combo-arrow {
    transform: translateX(3px);
}

/* ---------- 漢堡選單按鈕 ---------- */
.hamburger {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--color-primary-soft);
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    transition: background var(--transition);
}
.hamburger:hover { background: #d6eff9; }

.hamburger span {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.hamburger span:nth-child(1) { top: 15px; }
.hamburger span:nth-child(2) { top: 21px; width: 14px; }
.hamburger span:nth-child(3) { top: 27px; }

.hamburger.active span:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}
.hamburger.active span:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

/* ---------- 移動端彈出選單 ---------- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 88%;
    max-width: 360px;
    height: 100vh;
    background: #fff;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 60px rgba(26, 39, 51, 0.15);
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 39, 51, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-header {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--color-primary-soft) 0%, #fff 100%);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mobile-brand img { width: 32px; height: 32px; }
.mobile-brand .brand-name { font-size: 16px; }

.mobile-menu-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.mobile-menu-close:hover {
    color: var(--color-primary);
    transform: rotate(90deg);
}

.mobile-menu-nav {
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    border: 1px solid transparent;
}

.mobile-menu-nav a::after {
    content: "›";
    font-size: 22px;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-color: rgba(51, 175, 225, 0.2);
}
.mobile-menu-nav a:hover::after,
.mobile-menu-nav a.active::after {
    color: var(--color-primary);
    transform: translateX(4px);
}

.mobile-menu-actions {
    margin-top: auto;
    padding: 20px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--color-border);
}

.mobile-menu-actions .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
}

.mobile-menu-footer {
    padding: 0 24px 20px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

/* ---------- 響應式 ---------- */
@media (max-width: 1024px) {
    .header-nav { display: none; }
    .hamburger { display: flex; }
    /* 縮小 CTA 副標題，保留主體 */
    .cta-combo-sub { display: none; }
    .cta-combo { padding: 6px 6px 6px 12px; gap: 10px; }
    .cta-combo-arrow { width: 26px; height: 26px; }
}

@media (max-width: 768px) {
    :root { --header-height: 64px; }
    .header-brand img { width: 32px; height: 32px; }
    .brand-name { font-size: 16px; }
    .brand-sub { font-size: 10px; }
    /* 移動端導航區不再顯示主 CTA（已在漢堡選單內提供） */
    .header-actions .cta-combo { display: none; }
}

/* 移動端彈出選單內的 CTA：放大鋪滿 */
.mobile-menu-actions .cta-combo {
    width: 100%;
    justify-content: space-between;
    padding: 10px 12px 10px 16px;
}
.mobile-menu-actions .cta-combo-sub { display: block; }

/* ============================================================
   Language Switcher 語言切換器
   ============================================================ */
.lang-switcher {
    position: relative;
    display: inline-flex;
}

.lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}
.lang-trigger:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
    background: #fff;
    box-shadow: 0 4px 14px rgba(51, 175, 225, 0.12);
}
.lang-trigger-icon,
.lang-trigger-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lang-trigger-icon svg { width: 18px; height: 18px; }
.lang-trigger-arrow svg {
    width: 14px; height: 14px;
    transition: transform 0.25s ease;
    color: var(--color-text-muted);
}
.lang-switcher.open .lang-trigger-arrow svg { transform: rotate(180deg); }
.lang-switcher.open .lang-trigger {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
    background: #fff;
    box-shadow: 0 6px 18px rgba(51, 175, 225, 0.18);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(26, 39, 51, 0.14);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1100;
}
.lang-switcher.open .lang-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lang-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.lang-item:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
}
.lang-item.is-active {
    background: linear-gradient(135deg, rgba(51, 175, 225, 0.12), rgba(51, 175, 225, 0.04));
    color: var(--color-primary-dark);
}
.lang-item-label {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}
.lang-item-sub {
    font-size: 11.5px;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}
.lang-item.is-active .lang-item-sub { color: var(--color-primary); }

/* 移動端選單內的語言切換器：撐滿寬度，選單變為內嵌列表 */
.mobile-menu-actions .lang-switcher { width: 100%; }
.mobile-menu-actions .lang-trigger {
    width: 100%;
    height: 48px;
    justify-content: space-between;
    padding: 0 16px;
    background: #fff;
}
.mobile-menu-actions .lang-menu {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
    transform: none;
    background: var(--color-bg-soft);
}

@media (max-width: 768px) {
    /* 頂部導航欄移動端隱藏語言按鈕，統一在漢堡選單內操作 */
    .header-actions .lang-switcher { display: none; }
}
