/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-cream: #FDF6E9;
    --bg-white: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-orange: #F5A623;
    --accent-green: #52C41A;
    --price-red: #E74C3C;
    --border-color: #E8E8E8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50px;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* 背景装饰圆 */
.bg-circle {
    position: fixed;
    top: -150px;
    left: -150px;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #FFE4B5 0%, #FFEAA7 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.8;
}

/* 头部导航 */
.header {
    background: var(--bg-white);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.logo-icon-img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-cream);
    color: var(--text-primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.member-btn {
    background: var(--bg-cream);
    font-weight: 500;
}

/* 主要内容区域 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 24px;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.tab-btn:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.tab-btn.active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
}

/* 商品区块 */
.product-section {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to right, #fafafa, #ffffff);
}

/* 分类图标 - 自定义上传图片 */
.section-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* 分类图标 - 预设SVG图标 */
.section-icon-svg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-icon-svg.tiktok {
    background: #000000;
}

.section-icon-svg.facebook {
    background: #1877F2;
}

.section-icon-svg.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.section-icon-svg svg {
    width: 22px;
    height: 22px;
    color: white;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 商品列表 */
.product-list {
    padding: 0;
}

.product-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s ease;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item:hover {
    background: #fafafa;
}

/* 商品信息 */
.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 商品标签 */
.product-tags {
    display: flex;
    gap: 8px;
}

.tag {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.auto-tag {
    background: #f5f5f5;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* 库存 */
.product-stock {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

/* 价格 */
.product-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--price-red);
    min-width: 80px;
    text-align: right;
}

/* 购买按钮 */
.buy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.buy-btn:hover:not(.disabled) {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
}

.buy-btn.disabled {
    background: #f5f5f5;
    color: var(--text-muted);
    cursor: not-allowed;
}

.buy-btn svg {
    width: 16px;
    height: 16px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-cream);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-line + .hamburger-line {
    margin-top: 6px;
}

/* 汉堡菜单动画 - 激活状态 */
.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .product-item {
        grid-template-columns: 1fr auto auto auto;
    }
    
    .product-tags {
        display: none;
    }
}

@media (max-width: 900px) {
    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* 移动端导航样式 */
    .nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-white);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 16px 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 99;
    }
    
    .nav.active {
        transform: translateX(0);
    }
    
    .nav-item {
        padding: 16px 24px;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        font-size: 16px;
        justify-content: flex-start;
    }
    
    .nav-item:last-child {
        border-bottom: none;
    }
    
    .nav-item svg {
        width: 22px;
        height: 22px;
    }
    
    .member-btn {
        background: transparent;
        margin: 16px 24px;
        border-radius: var(--radius-sm);
        background: var(--bg-cream);
        justify-content: center;
    }
    
    .product-item {
        grid-template-columns: 1fr auto auto;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .product-stock {
        min-width: 60px;
        font-size: 12px;
    }
    
    .product-price {
        min-width: 60px;
        font-size: 16px;
    }
    
    .section-icon-img,
    .section-icon-svg {
        width: 36px;
        height: 36px;
    }
    
    .section-icon-svg svg {
        width: 20px;
        height: 20px;
    }
    
    /* 遮罩层 */
    .nav-overlay {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 98;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 10px 16px;
    }
    
    .logo-name {
        font-size: 16px;
    }
    
    .logo-desc {
        font-size: 11px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .category-tabs {
        gap: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 8px 16px;
        font-size: 13px;
        flex-shrink: 0;
    }
    
    .product-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 16px;
    }
    
    .product-info {
        grid-column: 1;
    }
    
    .product-stock {
        grid-column: 1 / -1;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .product-stock::after {
        content: attr(data-price);
    }
    
    .product-price {
        grid-column: 1 / -1;
        text-align: left;
    }
    
    .buy-btn {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .section-header {
        padding: 14px 16px;
    }
}

/* 横屏模式优化 */
@media (max-width: 900px) and (orientation: landscape) {
    .nav {
        top: 56px;
        padding: 8px 0;
    }
    
    .nav-item {
        padding: 12px 24px;
    }
    
    .nav-overlay {
        top: 56px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-section {
    animation: fadeIn 0.3s ease-out;
}

.product-item {
    animation: fadeIn 0.3s ease-out;
}

/* 隐藏样式 */
.hidden {
    display: none !important;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============ 弹窗样式 ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to right, #fafafa, #ffffff);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-cream);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
}

/* 公告弹窗样式 */
.announcement-modal {
    max-width: 520px;
}

.announcement-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
}

.announcement-modal .modal-header h3 {
    color: white;
}

.announcement-modal .modal-close {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

.announcement-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.announcement-modal .modal-body {
    font-size: 15px;
    color: var(--text-secondary);
}

.announcement-modal .modal-body a {
    color: var(--primary);
    text-decoration: none;
}

.announcement-modal .modal-body a:hover {
    text-decoration: underline;
}

/* 购买弹窗样式 */
.product-info-display {
    background: var(--bg-cream);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.product-info-display p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.product-info-display p:first-child {
    margin-top: 0;
}

.product-info-display p:last-child {
    margin-bottom: 0;
}

.product-info-display strong {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.1);
}

.form-group .required {
    color: var(--price-red);
    font-weight: bold;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: var(--radius-sm);
    margin-top: 20px;
}

.total-price span {
    font-size: 14px;
    color: var(--text-secondary);
}

.price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--price-red);
}

/* 按钮样式 */
.btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--accent-orange);
    color: white;
}

.btn-primary:hover {
    background: #e69520;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-cream);
    color: var(--text-primary);
}

/* 卡密显示区域 */
.cards-display {
    margin-top: 20px;
}

.cards-display label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cards-textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: monospace;
    resize: none;
    background: #f9f9f9;
}

.btn-copy {
    margin-top: 12px;
    background: var(--accent-green);
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

.btn-copy:hover {
    background: #45a617;
}

/* 错误消息 */
.error-msg {
    color: var(--price-red);
    font-weight: 500;
}

/* 响应式弹窗 */
@media (max-width: 600px) {
    .modal-content {
        max-width: 100%;
        margin: 10px;
        max-height: calc(100vh - 40px);
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 12px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

