/* 自定义全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    scroll-behavior: smooth;
}

/* 自定义动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 自定义按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: #4361ee;
    color: white;
    box-shadow: 0 4px 14px 0 rgba(67, 97, 238, 0.39);
}

.btn-primary:hover {
    background-color: #3a56d4;
    box-shadow: 0 6px 20px 0 rgba(67, 97, 238, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: white;
    color: #4361ee;
    border: 2px solid #4361ee;
}

.btn-secondary:hover {
    background-color: #f8faff;
    transform: translateY(-2px);
}

/* 自定义卡片样式 */
.card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}

/* 自定义输入框样式 */
.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-input::placeholder {
    color: #a0aec0;
}

/* 自定义标题样式 */
.section-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #64748b;
    margin-bottom: 3rem;
}

/* 自定义背景样式 */
.bg-gradient-primary {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
}

.bg-gradient-accent {
    background: linear-gradient(135deg, #f72585 0%, #4361ee 100%);
}

/* 自定义文本样式 */
.text-gradient-primary {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 自定义间距 */
.section-padding {
    padding-top: clamp(3rem, 8vw, 6rem);
    padding-bottom: clamp(3rem, 8vw, 6rem);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 加载动画 */
.loading-spinner {
    border: 3px solid rgba(67, 97, 238, 0.1);
    border-radius: 50%;
    border-top: 3px solid #4361ee;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具类 */
.text-balance {
    text-wrap: balance;
}

.content-auto {
    content-visibility: auto;
}

/* 回到顶部按钮 */
#scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: #4361ee;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.39);
    transition: all 0.3s ease;
    z-index: 100;
}

#scroll-to-top:hover {
    background-color: #3a56d4;
    transform: translateY(-5px);
}

/* 滚动进度指示器 */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 9999;
}

.progress-bar {
    height: 4px;
    background: #4361ee;
    width: 0%;
}

/* 确保平滑过渡 */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* 图片优化 */
img {
    max-width: 100%;
    height: auto;
}

/* 防止图片变形 */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* 骨架屏样式 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 确保可访问性 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    .btn {
        border: 2px solid #000;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a202c;
        color: #f7fafc;
    }
    .card {
        background-color: #2d3748;
        border: 1px solid #4a5568;
    }
    .form-input {
        background-color: #4a5568;
        border-color: #718096;
        color: #f7fafc;
    }
    .form-input::placeholder {
        color: #a0aec0;
    }
}

/* ========== 电商相关样式 ========== */

/* 商品卡片外层 - 内侧隐形边框 */
.product-card-wrapper {
    padding: 8px;
    border: 2px solid #ffffff;
    border-radius: 20px;
    background: #ffffff;
}
.product-card-wrapper .product-card {
    box-shadow: none;
}
.product-card-wrapper .product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* 商品卡片 */
.product-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}
.product-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}
.product-card .product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover .product-image {
    transform: scale(1.05);
}
.product-card .product-image-wrapper {
    overflow: hidden;
    position: relative;
}
.product-card .product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #f72585 0%, #4361ee 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* 价格显示 */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.product-price .current-price {
    font-size: 24px;
    font-weight: 700;
    color: #ef4444;
}
.product-price .original-price {
    font-size: 14px;
    color: #9ca3af;
    text-decoration: line-through;
}
.product-price .discount-tag {
    font-size: 12px;
    background-color: #fef2f2;
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 商品详情缩略图 */
.thumbnail-gallery {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.thumbnail-gallery img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.3s ease;
}
.thumbnail-gallery img.active,
.thumbnail-gallery img:hover {
    border-color: #4361ee;
}

/* 数量选择器 */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
}
.quantity-selector button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #f8fafc;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #4b5563;
}
.quantity-selector button:hover {
    background-color: #e2e8f0;
}
.quantity-selector button:disabled {
    color: #d1d5db;
    cursor: not-allowed;
}
.quantity-selector input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: none;
    border-left: 2px solid #e2e8f0;
    border-right: 2px solid #e2e8f0;
    font-size: 16px;
    outline: none;
}

/* 加入购物车按钮 */
.btn-add-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    background-color: #4361ee;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(67, 97, 238, 0.39);
}
.btn-add-cart:hover {
    background-color: #3a56d4;
    box-shadow: 0 6px 20px 0 rgba(67, 97, 238, 0.5);
    transform: translateY(-2px);
}
.btn-add-cart:active {
    transform: translateY(0);
}
.btn-add-cart.added {
    background-color: #22c55e;
    box-shadow: 0 4px 14px 0 rgba(34, 197, 94, 0.39);
}

/* 立即购买按钮 */
.btn-buy-now {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #f72585 0%, #4361ee 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(247, 37, 133, 0.39);
}
.btn-buy-now:hover {
    box-shadow: 0 6px 20px 0 rgba(247, 37, 133, 0.5);
    transform: translateY(-2px);
}

/* 购物车页面 */
.cart-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
    transition: box-shadow 0.3s ease;
}
.cart-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.cart-item .cart-checkbox {
    width: 22px;
    height: 22px;
    margin-right: 16px;
    accent-color: #4361ee;
    cursor: pointer;
}
.cart-item .cart-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 20px;
    flex-shrink: 0;
}
.cart-item .cart-info {
    flex: 1;
}
.cart-item .cart-info h4 {
    font-weight: 600;
    margin-bottom: 8px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cart-item .cart-info .price {
    color: #ef4444;
    font-weight: 700;
    font-size: 18px;
}
.cart-item .cart-remove {
    padding: 8px 16px;
    background-color: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}
.cart-item .cart-remove:hover {
    background-color: #fecaca;
}

/* 购物车底部结算栏 */
.cart-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 0;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* 付款弹窗 */
.payment-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.payment-modal:not(.hidden) {
    display: flex !important;
}
.payment-modal .modal-content {
    background-color: white;
    border-radius: 16px;
    padding: 40px 32px 32px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.payment-modal .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}
.payment-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}
.payment-option:hover,
.payment-option.selected {
    border-color: #4361ee;
    background-color: #f0f4ff;
}
.payment-option .payment-icon {
    font-size: 32px;
    margin-right: 16px;
}
.qr-placeholder {
    width: 200px;
    height: 200px;
    background-color: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

/* 付费阅读卡片 */
.paid-article-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}
.paid-article-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}
.paid-article-card .lock-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,0.8) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}
.paid-article-card:hover .lock-overlay {
    opacity: 1;
}
.paid-price-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.paid-price-tag::before {
    content: '\f023';
    font-family: 'FontAwesome';
    margin-right: 6px;
}

/* 商家入驻表单 */
.merchant-form-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 40px;
}
.merchant-form-card .form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.merchant-form-card .form-group {
    margin-bottom: 24px;
}
.merchant-form-card .form-help {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* 用户评价 */
.review-item {
    padding: 20px 0;
    border-bottom: 1px solid #f3f4f6;
}
.review-item:last-child {
    border-bottom: none;
}

/* 猜你喜欢 */
.guess-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
}
.guess-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

/* 商品详情内容 */
.detail-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #1f2937;
}
.detail-content ul {
    padding-left: 20px;
    margin-bottom: 16px;
}
.detail-content ul li {
    margin-bottom: 8px;
    color: #4b5563;
}
.detail-content p {
    color: #4b5563;
    margin-bottom: 16px;
    line-height: 1.8;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.category-tab {
    padding: 8px 20px;
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    background-color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: #4b5563;
}
.category-tab:hover {
    border-color: #4361ee;
    color: #4361ee;
}
.category-tab.active {
    background-color: #4361ee;
    border-color: #4361ee;
    color: white;
}

/* 导航栏登录文字 */
.auth-login-text {
    font-size: 15px;
    font-weight: 500;
    color: inherit;
}

/* 导航栏用户菜单 */
.auth-user-menu {
    position: relative;
}
.auth-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: -8px;
    min-width: 190px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 999;
    border: 1px solid #f0f0f0;
    animation: dropdownFadeIn 0.15s ease;
}
.auth-menu-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: white;
    border-left: 1px solid #f0f0f0;
    border-top: 1px solid #f0f0f0;
    transform: rotate(45deg);
}
.auth-menu-dropdown a,
.auth-menu-dropdown button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
}
.auth-menu-dropdown a:hover {
    background: #f8f9ff;
    color: #4361ee;
}
.auth-menu-dropdown a:hover i {
    color: #4361ee;
}
.auth-menu-dropdown button:hover {
    background: #fef2f2;
    color: #ef4444;
}
.auth-menu-dropdown i {
    color: #9ca3af;
    transition: color 0.15s ease;
    width: 20px;
    text-align: center;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 导航栏购物车图标 */
.cart-badge {
    position: relative;
}
.cart-badge .badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ef4444;
    color: white;
    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;
}

/* 统计条 */
.article-stats {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    border-top: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    margin-top: 16px;
}
.article-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 14px;
}
.article-stats .stat-item i {
    color: #4361ee;
}

/* 文本截断 */
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* 付款成功动画 */
.payment-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}
.payment-success-card {
    background: white;
    border-radius: 24px;
    padding: 48px 40px 36px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: successPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes successPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkBounce 0.6s ease 0.2s both;
}
.success-checkmark i {
    color: white;
    font-size: 40px;
}
@keyframes checkBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.payment-success-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
    animation: fadeInUp 0.4s ease 0.4s both;
}
.payment-success-card p {
    color: #6b7280;
    font-size: 16px;
    margin-bottom: 8px;
    animation: fadeInUp 0.4s ease 0.5s both;
}
.payment-success-card .success-amount {
    font-size: 28px;
    font-weight: 700;
    color: #22c55e;
    margin: 16px 0 24px;
    animation: fadeInUp 0.4s ease 0.6s both;
}
.payment-success-card .btn-ok {
    padding: 12px 48px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
    animation: fadeInUp 0.4s ease 0.7s both;
}
.payment-success-card .btn-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}