/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e74c3c;
    --header-height: 50px;
    --filter-height: 52px;
    --footer-height: 56px;
    --sidebar-width: 280px;
    --transition: 0.3s ease;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f2f2f2;
    color: #333;
    line-height: 1.6;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}

/* ========== Header / 顶部标题区 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 100;
    border-bottom: 1px solid #e5e5e5;
}

.header-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.header-counter {
    font-size: 0.82rem;
    color: #999;
    font-weight: 400;
    margin-left: 6px;
}

.header-catalog-btn {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.header-catalog-btn:active {
    opacity: 0.85;
    transform: scale(0.96);
}

.header-catalog-btn svg {
    flex-shrink: 0;
}

/* ========== Store Button / 门店切换按钮 ========== */
.header-store-btn {
    margin-left: auto;
    background: transparent;
    color: #333;
    border: none;
    padding: 8px 10px 8px 12px;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    max-width: 160px;
    line-height: 1.2;
}

.header-store-btn:active {
    opacity: 0.7;
}

.header-store-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    font-weight: 500;
}

.header-store-btn svg {
    flex-shrink: 0;
    color: #999;
}

.header-store-btn .store-arrow {
    margin-left: -2px;
}

/* ========== Store Panel / 门店选择弹窗 ========== */
.store-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-height);
    bottom: var(--footer-height);
    background: #fff;
    display: none;
    flex-direction: column;
    z-index: 301;
    overflow: hidden;
}

#storeModal.active .store-panel {
    display: flex;
}

.store-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 44px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.store-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

.store-option {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.store-option:active {
    background: #f0f0f0;
    transform: scale(0.98);
}

.store-option-active {
    background: #fff5f5;
    border: 1px solid var(--primary);
}

.store-option-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.store-option-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #333;
}

.store-option-active .store-option-name {
    color: var(--primary);
}

.store-option-desc {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
    white-space: normal;
    word-break: break-all;
}

.store-option-check {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ========== Filter Bar / 标签筛选栏 ========== */
.filter-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    z-index: 99;
    transition: height 0.3s ease;
    height: var(--filter-height);
    padding-bottom: 2px;
}

.filter-bar.expanded {
    height: auto;
    max-height: 220px;
    overflow-y: auto;
}

.filter-scroll {
    display: flex;
    align-items: flex-start;
    padding: 8px 8px 0;
    flex-wrap: wrap;
    overflow: hidden;
    height: 38px;
}

.filter-bar.expanded .filter-scroll {
    overflow: visible;
    height: auto;
}

.filter-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    margin-top: -5px;
    font-size: 0.72rem;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    gap: 3px;
}

.filter-toggle:active {
    color: #888;
}

.filter-toggle svg {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.filter-bar.expanded .filter-toggle svg {
    transform: rotate(180deg);
}

.filter-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    color: #555;
    text-decoration: none;
    background: #f5f5f5;
    transition: all 0.25s ease;
    border: 1px solid #f0f0f0;
    white-space: nowrap;
    margin: 4px 3px;
    box-sizing: border-box;
}

.filter-tag.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.filter-tag:active {
    transform: scale(0.95);
}

/* ========== Catalog Sidebar / 分类侧栏 ========== */
.catalog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.catalog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.catalog-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: var(--sidebar-width);
    height: 100%;
    background: #fff;
    z-index: 200;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.catalog-sidebar.active {
    right: 0;
}

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--header-height);
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.catalog-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 1.4rem;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.catalog-close:hover {
    background: #f5f5f5;
    color: #333;
}

.catalog-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.catalog-item {
    display: block;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.88rem;
    border-bottom: 1px solid #f5f5f5;
    transition: var(--transition);
}

.catalog-item:active {
    background: #f9f9f9;
}

.catalog-item.active {
    color: var(--primary);
    font-weight: 600;
    background: #fff5f5;
    border-left: 3px solid var(--primary);
}

.catalog-item.disabled {
    color: #ccc;
    pointer-events: none;
}

/* ========== Gallery / 中间图册区 - 单张图片 ========== */
.gallery {
    flex: 1;
    position: relative;
    margin-top: calc(var(--header-height) + var(--filter-height));
    margin-bottom: var(--footer-height);
    height: calc(100vh - var(--header-height) - var(--filter-height) - var(--footer-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    overflow: hidden;
}

.gallery-image-wrap {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.gallery-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-image.loading {
    opacity: 0.3;
}

/* 价格表区域 */
.gallery-detail {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    padding: 8px 16px 10px;
    max-height: 40%;
    overflow-y: auto;
}

.gallery-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 8px;
}

.gallery-detail-name {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: left;
}

.gallery-detail-code {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* 价格表格 */
.price-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.price-table-wrap::-webkit-scrollbar { display: none; }

.price-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
}

.price-table th,
.price-table td {
    padding: 8px 6px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.92rem;
}

.price-table th {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 500;
    letter-spacing: 1px;
}

.price-table td {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    position: relative;
}

.price-table .price-current {
    font-weight: 700;
    font-size: 1rem;
}

.price-table .price-old {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
    text-decoration: line-through;
    margin-left: 4px;
}

.price-table .price-nav {
    padding: 4px 0;
}
.price-table .price-nav-hint {
    color: rgba(255,255,255,0.35);
    font-size: 0.78rem;
}
.price-table .price-nav-btn {
    display: inline-block;
    padding: 4px 14px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}
.price-table .price-nav-btn:active {
    background: rgba(255,255,255,0.15);
}
.price-table .price-nav-disabled {
    display: inline-block;
    padding: 4px 14px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.2);
    cursor: default;
    border-radius: 3px;
}

/* 价格表左右滑动动画 */
.price-table .price-tbody {
    transition: transform 0.28s ease-out, opacity 0.28s ease-out;
}
.price-table .price-tbody.price-slide-left {
    transform: translateX(40px);
    opacity: 0;
}
.price-table .price-tbody.price-slide-right {
    transform: translateX(-40px);
    opacity: 0;
}

/* 加载状态 */
.gallery-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    gap: 12px;
    z-index: 5;
}

.gallery-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.gallery-loading.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Swipe Hint / 滑动提示 ========== */
.swipe-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.swipe-hint.hidden {
    opacity: 0;
    visibility: hidden;
}

.swipe-hint .hint-arrow {
    animation: swipeHintBounce 1.2s ease-in-out infinite;
}

.swipe-hint .hint-arrow:first-child {
    animation-delay: 0s;
}

.swipe-hint .hint-arrow:last-child {
    animation-delay: 0.6s;
}

.swipe-hint .hint-text {
    writing-mode: vertical-rl;
    letter-spacing: 4px;
}

@keyframes swipeHintBounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(4px); opacity: 1; }
}

/* ========== Footer / 底部功能按钮区 ========== */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    border-top: 1px solid #e5e5e5;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: #666;
    font-size: 0.65rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: var(--transition);
}

.footer-btn:active {
    transform: scale(0.92);
    background: #f5f5f5;
}

.footer-btn--list {
    color: #3498db;
}

.footer-btn--jump {
    color: #e67e22;
}

.footer-btn--play {
    color: #8e44ad;
}

.footer-btn--play.active svg {
    fill: #8e44ad;
}

.footer-btn--phone {
    color: #e74c3c;
}

.footer-btn svg {
    flex-shrink: 0;
}

/* ========== Modal / 微信弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

/* 列表面板遮罩层：定位在标题栏和底部栏之间 */
#listModal {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-height);
    bottom: var(--footer-height);
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

#listModal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 280px;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.3rem;
    color: #999;
    cursor: pointer;
    border: none;
    background: none;
    transition: var(--transition);
}

.modal-close:hover {
    background: #f5f5f5;
}

.modal-body {
    padding: 24px 20px 28px;
    text-align: center;
}

.qrcode-box {
    width: 160px;
    height: 160px;
    margin: 0 auto 14px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #ddd;
}

.modal-body p {
    font-size: 0.8rem;
    color: #999;
    line-height: 1.7;
}

/* ========== List Panel / 缩略图列表面板 ========== */
.list-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-height);
    bottom: var(--footer-height);
    background: #fff;
    display: none;
    flex-direction: column;
    z-index: 151;
    overflow: hidden;
}

#listModal.active .list-panel {
    display: flex;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 44px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.list-grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    min-height: 0;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
    .list-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

.list-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    background: #f5f5f5;
}

.list-thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s ease;
}

.list-thumb.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--primary);
    border-radius: 8px;
    pointer-events: none;
}

.list-thumb .list-thumb-num {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.85rem;
    padding: 1px 7px;
    border-radius: 3px;
}

.list-thumb .list-thumb-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
    font-size: 0.9rem;
    padding: 16px 5px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Contact Panel / 联系我们弹出层 ========== */
.contact-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-height);
    bottom: var(--footer-height);
    background: #fff;
    display: none;
    flex-direction: column;
    z-index: 301;
    overflow: hidden;
}

#contactModal.active .contact-panel {
    display: flex;
}

.contact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 44px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.contact-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    line-height: 1.8;
    font-size: 0.88rem;
    color: #444;
}

.contact-body .contact-section {
    margin-bottom: 18px;
}

.contact-body .contact-section-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.contact-body .contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.contact-body .contact-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.contact-body .contact-item-label {
    color: #888;
    font-size: 0.8rem;
    min-width: 52px;
}

.contact-body .contact-item-value {
    color: #333;
    font-weight: 500;
}

.contact-body .contact-item-value a {
    color: var(--primary);
    text-decoration: none;
}

.contact-body .contact-item-value a:active {
    opacity: 0.7;
}

.contact-body .contact-qrcode-row {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.contact-body .contact-qrcode-item {
    text-align: center;
    min-width: 130px;
}

.contact-body .contact-qrcode-img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    font-size: 0.75rem;
    color: #aaa;
}

.contact-body .contact-qrcode-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.contact-body .contact-qrcode-label {
    width: 120px;
    margin: 0 auto;
    font-size: 0.78rem;
    color: #666;
    text-align: center;
    word-break: break-word;
}

/* ========== Jump Modal / 跳转页码弹窗 ========== */
.jump-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
}

.jump-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

.jump-confirm {
    width: 100%;
    margin-top: 14px;
    padding: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.jump-confirm:active {
    opacity: 0.85;
}

/* ========== Share Toast ========== */
.share-toast {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.share-toast.active {
    opacity: 1;
    visibility: visible;
}

.share-toast p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 0; height: 0; }

/* ========== Desktop ========== */
@media (min-width: 768px) {
    .catalog-sidebar {
        width: 320px;
    }
    .gallery-image-wrap {
        max-width: 60%;
        margin: 0 auto;
    }
    .slide-vertical {
        max-width: 60%;
        margin: 0 auto;
        left: 0;
        right: 0;
    }
}
