/* ============================================================
 * ZOQUI Shared Styles — 跨页面公共组件
 * 包含：CSS变量 / 全局重置 / navbar / cart drawer / language switcher / mobile nav
 * 加载顺序：必须在各页面主样式之前
 * ============================================================ */

/* ═══════ CSS 自定义属性（品牌色板）═══════ */
:root {
    --purple: #7B3FA0;
    --purple-light: #A569BD;
    --purple-dark: #5B2C6F;
    --pink: #E91E8C;
    --pink-light: #F06292;
    --pink-soft: #FCE4EC;
    --cream: #FDF8F5;
    --lavender: #F3E5F5;
    --white: #FFFFFF;
    --dark: #1A1A2E;
    --medium: #4A4A5A;
    --light: #8A8A9A;
    --border: #EDE0F0;
}

/* ═══════ 全局重置 ═══════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 顶层横向溢出兜底：html 层裁剪横向滚动，防止跑马灯/装饰元素/skeleton 等
   在超窄屏下把 documentElement.scrollWidth 撑大（body 层裁剪仍不够，需 html 层同步裁剪） */
html {
    overflow-x: hidden;
    overflow-y: scroll;
    background: var(--cream);
}

/* 桌面端：滚动条始终占位，避免「长页有滚动条 / 短页无滚动条」切换时页面横向跳变 */
/* 手机端不设 scrollbar-gutter（手机用覆盖式滚动条不占空间，设了反而多出白边） */
@media (min-width: 769px) {
    html { scrollbar-gutter: stable; }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.navbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 32px;
    display: flex; align-items: center; justify-content: space-between; height: 96px;
}
.logo { display: flex; align-items: center; text-decoration: none; cursor: pointer; border-radius: 0; padding: 0; }
.logos { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.logo img { height: 104px; width: auto; transition: transform 0.3s, opacity 0.3s; display: block; }
.logo:hover img { transform: scale(1.05); }
.nav-center { margin-left: 28px; }
.nav-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; flex-wrap: nowrap; }
.nav-links a {
    text-decoration: none; color: #1A1A2E;
    font-size: 15px; font-weight: 600; letter-spacing: 0.01em;
    cursor: pointer; transition: color 0.2s; position: relative;
    padding: 8px 4px; white-space: nowrap;
}

/* 中等视口压缩档已移除（2026-08-28）：字体不压缩，断点直接设在完整导航最小宽度 1130px，见下方 @media 折叠规则 */
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 4px; width: 0; height: 2px;
    background: linear-gradient(90deg, #7B3FA0, #E91E8C);
    transition: width 0.3s; border-radius: 1px;
}
.nav-links a:hover, .nav-links a.active {
    color: #7B3FA0;
}
.nav-links a:hover::after, .nav-links a.active::after { width: calc(100% - 8px); }

/* ===== 未登录 My Account 按钮（与登录后用户头像同位置，纯图标）===== */
#navAccountItem {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.nav-account-link {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 50%;
    padding: 8px; cursor: pointer;
    text-decoration: none; color: var(--dark, #1A1A2E);
    transition: background .2s, color .2s;
    font-family: inherit;
}
.nav-account-icon { flex-shrink: 0; display: block; width: 26px; height: 26px; }
.nav-account-link:hover {
    color: var(--purple, #7B3FA0);
}

/* ===== 登录后账户图标下拉菜单 ===== */
.nav-user-menu { position: relative; }
.nav-user-trigger { position: relative; }
.nav-user-dropdown {
    position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(-8px); background: white;
    border: 1.5px solid var(--border, #EDE0F0); border-radius: 12px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); min-width: 190px; z-index: 2100;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.nav-user-dropdown.open { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.nav-user-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 16px; text-decoration: none; border: none; background: none;
    cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--medium, #4A4A5A);
    font-family: inherit; text-align: left; transition: background 0.15s, color 0.15s;
}
.nav-user-item .nav-user-ico { flex-shrink: 0; width: 18px; text-align: center; font-size: 15px; }
.nav-user-item:hover { background: var(--lavender, #F3E5F5); color: var(--purple, #7B3FA0); }
.nav-user-logout { border-top: 1px solid var(--border, #EDE0F0); color: #dc2626; }
.nav-user-logout:hover { background: #fef2f2; color: #dc2626; }

/* ===== 购物车按钮 ===== */
.cart-btn {
    position: relative; background: none; border: none; cursor: pointer;
    color: var(--dark, #1A1A2E); padding: 8px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.cart-btn svg { width: 26px; height: 26px; }
.cart-btn:hover { color: var(--purple, #7B3FA0); background: rgba(124, 58, 237, .08); }
.cart-count {
    position: absolute; top: -2px; right: -4px;
    background: var(--purple, #7B3FA0); color: #fff;
    font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1;
}

/* ===== 购物车侧边栏 ===== */
.cart-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
    z-index: 1200; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer {
    position: fixed; top: 0; right: -420px; width: 380px; max-width: 96vw; height: 100vh;
    background: #fff; z-index: 1201; display: flex; flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, .12);
    transition: right .35s cubic-bezier(.4, 0, .2, 1);
}
.cart-drawer.open { right: 0; }
.cart-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 16px; border-bottom: 1px solid #f0f0f0;
}
.cart-drawer-title { font-size: 16px; font-weight: 700; color: #111; }
.cart-drawer-close {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: #f3f4f6; color: #6b7280; cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.cart-drawer-close:hover { background: #e5e7eb; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #9ca3af; font-size: 14px; text-align: center; padding: 40px 20px;
}
.cart-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid #f3f4f6; align-items: flex-start;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
    width: 60px; height: 60px; border-radius: 8px; object-fit: cover;
    background: #f3f4f6; flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; color: #111; margin-bottom: 3px; line-height: 1.4; }
.cart-item-price { font-size: 12px; color: #7c3aed; font-weight: 700; }
.cart-item-controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.qty-btn {
    width: 24px; height: 24px; border-radius: 6px; border: 1px solid #e5e7eb;
    background: #fff; cursor: pointer; font-size: 14px; font-weight: 700; color: #374151;
    display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.qty-btn:hover { border-color: #7c3aed; color: #7c3aed; }
.qty-num { font-size: 13px; font-weight: 700; color: #111; min-width: 20px; text-align: center; }
.cart-item-remove {
    background: none; border: none; cursor: pointer; color: #d1d5db;
    font-size: 16px; padding: 2px; transition: color .2s; align-self: flex-start;
}
.cart-item-remove:hover { color: #ef4444; }
.cart-footer {
    border-top: 1px solid #f0f0f0; padding: 16px 20px 24px; background: #fff;
}
.cart-total {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; font-size: 15px; font-weight: 600; color: #111;
}
.cart-total-price { font-size: 20px; font-weight: 800; color: #7c3aed; }
.cart-checkout-btn {
    width: 100%; padding: 13px; border-radius: 12px; border: none;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: all .2s; margin-bottom: 8px;
}
.cart-checkout-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124, 58, 237, .35); }
.cart-clear-btn {
    width: 100%; padding: 10px; border-radius: 10px;
    border: 1px solid #e5e7eb; background: #fff;
    color: #6b7280; font-size: 13px; cursor: pointer; transition: all .2s;
}
.cart-clear-btn:hover { background: #f9fafb; color: #374151; }
.cart-zip {
    display: flex; gap: 6px; margin-bottom: 12px;
    padding: 12px 0 8px; border-top: 1px dashed #e5e7eb;
}
.cart-zip input {
    flex: 1; padding: 9px 10px; border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 13px; color: #111; background: #fff; outline: none; transition: border .2s;
}
.cart-zip input:focus { border-color: #7c3aed; }
.cart-zip-btn {
    padding: 0 14px; border: none; border-radius: 8px;
    background: #111; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
}
.cart-zip-btn:hover { background: #7c3aed; }
.cart-summary-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #4b5563; margin-bottom: 5px;
}
.cart-summary-row.total {
    font-size: 16px; font-weight: 800; color: #111;
    border-top: 1px solid #f0f0f0; padding-top: 8px; margin-top: 8px;
}
.cart-summary-row .v { font-weight: 700; }
.cart-summary-row.total .v { color: #7c3aed; }
.cart-free-shipping-hint {
    font-size: 11px; color: #10b981; font-weight: 600;
    background: #ecfdf5; border-radius: 6px; padding: 5px 8px; margin-bottom: 8px;
    text-align: center;
}
.cart-empty-cart-cta {
    display: inline-block; margin-top: 16px; padding: 10px 24px;
    background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
    border-radius: 24px; font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all .2s;
}
.cart-empty-cart-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124, 58, 237, .4); }

/* ===== Language Switcher (momcozy 风格：地球图标 + USD/EN 无边框) ===== */
.lang-switcher { position: relative; }
.lang-btn {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    border: none; border-radius: 24px; background: transparent;
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--dark, #1A1A2E);
    letter-spacing: 0.02em; transition: all 0.2s;
}
.lang-btn:hover { background: rgba(124, 58, 237, .08); color: var(--purple, #7B3FA0); }
.lang-globe { flex-shrink: 0; width: 22px; height: 22px; }
.lang-btn .label { white-space: nowrap; }
.lang-btn .arrow { font-size: 10px; transition: transform 0.2s; color: var(--medium, #4A4A5A); }
.lang-btn.open .arrow { transform: rotate(180deg); }
.lang-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; background: white;
    border: 1.5px solid var(--border, #EDE0F0); border-radius: 12px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); min-width: 150px;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: all 0.2s;
}
.lang-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-option {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    cursor: pointer; font-size: 13px; color: var(--medium, #4A4A5A); transition: background 0.15s;
}
.lang-option .opt-cur { font-size: 11px; color: #9ca3af; font-weight: 600; letter-spacing: .02em; min-width: 28px; }
.lang-option:hover { background: var(--lavender, #F3E5F5); }
.lang-option.selected { color: var(--purple, #7B3FA0); font-weight: 600; }
.lang-option .check { margin-left: auto; color: var(--purple, #7B3FA0); font-weight: 700; }

/* ===== Mobile Nav ===== */
.mobile-toggle {
    display: none; background: none; border: none; cursor: pointer; padding: 8px;
}
.mobile-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--dark, #1A1A2E); margin: 5px 0; border-radius: 2px; transition: 0.3s;
}
.mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.4); z-index: 2000;
    opacity: 0; transition: opacity 0.3s;
}
.mobile-overlay.open { opacity: 1; }
.mobile-panel {
    position: fixed; top: 0; right: -280px; width: 280px; height: 100%; background: white;
    z-index: 2001; transition: right 0.3s; padding: 24px; box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}
.mobile-panel.open { right: 0; }
.mobile-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: var(--medium, #4A4A5A); margin-bottom: 24px;
}
.mobile-panel a {
    display: block; padding: 14px 0; text-decoration: none;
    color: var(--medium, #4A4A5A); font-size: 16px; font-weight: 500;
    border-bottom: 1px solid var(--border, #EDE0F0);
}
.mobile-panel a.active { color: var(--purple, #7B3FA0); }

/* ===== Page System ===== */
.page { display: none; padding-top: 96px; }
.page.active { display: block; }

/* ===== Page Banner ===== */
.page-banner {
    background: linear-gradient(135deg, var(--cream, #FDF8F5) 0%, var(--lavender, #F3E5F5) 50%, var(--pink-soft, #FCE4EC) 100%);
    padding: 64px 32px 48px; text-align: center;
}
.page-banner h1 {
    font-family: 'Playfair Display', serif; font-size: 42px; font-weight: 700;
    color: var(--dark, #1A1A2E); margin-bottom: 12px;
}
.page-banner h1 em { color: var(--purple, #7B3FA0); font-style: italic; }
.page-banner p { color: var(--medium, #4A4A5A); font-size: 16px; max-width: 560px; margin: 0 auto; }
.breadcrumb { margin-bottom: 16px; font-size: 13px; color: var(--light, #8A8A9A); }
.breadcrumb a { color: var(--purple, #7B3FA0); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 8px; }

/* ===== Page Transition — 由各页面 <head> 内联样式控制 ===== */
/* 此处仅保留全局 keyframes，供内联样式引用 */
@keyframes zq-spin { to { transform: rotate(360deg); } }

/* ===== Page Enter Animation ===== */
/* 纯 opacity 淡入，不做 translateY 位移：transform 会把 main 提升为合成层并光栅化文字，
   动画结束移除 transform 时文字从「位图缩放」切回「矢量渲染」，产生字体放大又缩小的跳变。 */
.zoqui-page-enter {
    animation: zq-page-in 0.5s ease-out both;
}
@keyframes zq-page-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== Page Pending (数据就位前的等待态) ===== */
/* 异步页面在数据就位前让整页保持 opacity:0（完全不可见），避免「先亮 spinner → 后暗 → 再淡入」的三段跳变。
   数据就位后移除本类并加 .zoqui-page-enter，一次性淡入。 */
.zq-page-pending {
    opacity: 0 !important;
}

/* ===== 移动端导航栏（≤1130px 折叠为汉堡） =====
   断点依据：字体不压缩（15px、28px gap）时，完整桌面导航最小需求宽度实测为 1130px
   （logo 214 + gap 28 + links 598 + right 226 + padding 64），低于该宽度导航项即被挤压，
   故折叠断点设在此极限交接点。 */
@media (max-width: 1130px) {
    .nav-links { display: none; }
    .mobile-toggle { display: block; }
    .lang-switcher { display: none; }
    .nav-right { gap: 4px; flex-shrink: 0; }
    .navbar-inner { padding: 0 12px; height: 64px; }

    /* logo 连续流式缩放：随视口合理缩放 */
    .logo img {
        height: clamp(64px, 20vw, 96px);
        max-height: 96px;
        width: auto;
        max-width: 30vw;
        object-fit: contain;
    }
    /* logo 容器允许收缩，主动让位给右侧图标 */
    .logos { flex-shrink: 1; min-width: 0; gap: 4px; }
}

/* 超窄屏（≤360px，如旧款 iPhone SE / 最小安卓）兜底 */
@media (max-width: 360px) {
    .logo img { max-width: 28vw; }
    .nav-right { gap: 2px; }
}
