/* public/css/shop.css */
/* 版本：1.1 (修复布局问题) */
/* 说明：包含“代码商城”页面的所有专属样式、交互效果及响应式设计。 */

/* --- 变量与通用 --- */
:root {
    --shop-bg-light: #fff;
    --shop-bg-dark: #f7f7f7;
    --shop-text-primary: #1d1d1f;
    --shop-text-secondary: #555;
    --shop-brand-color: var(--brand-color, #007AFF);
    --section-padding: 6rem 0;
}
.shop-page .btn {
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-family: var(--font-bold);
    transition: all 0.3s ease;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}
.shop-page .btn-primary { background-color: var(--shop-brand-color); color: #fff; }
.shop-page .btn-primary:hover { background-color: #0056b3; }


/* --- 1. Hero & Filter --- */
.shop-hero {
    /* 变更: 使用变量动态适应页眉高度，修复标题遮挡问题 */
    padding: var(--header-height, 92px) 20px 60px;
    text-align: center;
    background-color: var(--shop-bg-dark);
}
.shop-title {
    font-size: clamp(2.8rem, 6vw, 4rem);
    font-family: var(--font-bold);
    margin: 0 0 0.5rem 0;
}
.shop-subtitle {
    font-size: 1.2rem;
    color: var(--shop-text-secondary);
    margin: 0;
}
.filter-bar {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}
.filter-btn {
    background: #e9e9e9;
    color: #333;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
}
.filter-btn.active {
    background: var(--shop-brand-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

/* --- 2. Product Grid --- */
.shop-grid-section {
    padding: var(--section-padding);
}
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}
.product-card {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.07);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
}
.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.card-image-wrapper {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}
.card-image {
    display: block;
    width: 100%;
    height: 220px;
    /* 变更: 确保图片完整显示，不被裁剪 */
    object-fit: contain;
    /* 新增: 为图片未填满的区域提供一个柔和的背景色 */
    background-color: #f7f7f7;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.card-actions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 1rem;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s 0.1s ease, opacity 0.4s 0.1s ease;
}
.btn-action {
    flex: 1;
    text-align: center;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    font-size: 0.9rem;
    font-family: var(--font-bold);
    border: none;
    cursor: pointer;
}
.btn-action:hover {
    background: #fff;
}
.product-card:hover .card-image {
    transform: scale(1.05);
}
.product-card:hover .card-overlay, .product-card:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

.card-info {
    padding: 1.5rem;
}
.card-title {
    font-size: 1.3rem;
    font-family: var(--font-bold);
    margin: 0 0 0.5rem 0;
    color: var(--shop-text-primary);
}
.card-price {
    font-size: 1.2rem;
    color: var(--shop-brand-color);
    font-family: var(--font-bold);
    margin: 0;
}

/* --- 3. Why Us Section --- */
.why-us-section {
    padding: var(--section-padding);
    background: var(--shop-bg-dark);
}
.why-us-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}
.why-us-card {
    text-align: center;
}
.why-us-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}
.why-us-card h3 {
    font-family: var(--font-bold);
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
}
.why-us-card p {
    color: var(--shop-text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* --- 4. FAQ Section --- */
.faq-section {
    padding: var(--section-padding);
}
.faq-accordion {
    max-width: 800px;
    margin: 0 auto;
    border-top: 1px solid #eee;
}
.faq-item {
    border-bottom: 1px solid #eee;
}
.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 1.2rem;
    font-family: var(--font-bold);
}
.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding-bottom 0.4s ease-out;
}
.faq-answer p {
    padding: 0 0 1.5rem 0;
    margin: 0;
    color: var(--shop-text-secondary);
    line-height: 1.8;
}
.faq-item.active .faq-question {
    color: var(--shop-brand-color);
}
.faq-item.active .faq-icon {
    transform: rotate(45deg);
}
.faq-item.active .faq-answer {
    max-height: 200px; /* 预估高度 */
    padding-bottom: 1.5rem;
}

/* --- 5. Product Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: #fff; border-radius: 16px; max-width: 960px;
    width: 90%; max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; font-size: 2rem;
    color: #aaa; cursor: pointer; z-index: 10;
}
.modal-body {
    display: flex; gap: 2.5rem; padding: 2.5rem;
    overflow-y: auto;
}
.modal-gallery { flex: 1; min-width: 0; }
#modal-main-image { width: 100%; border-radius: 8px; }
.modal-thumbnails { display: flex; gap: 0.5rem; margin-top: 1rem; }
.modal-thumbnails img { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.7; }
.modal-thumbnails img.active { opacity: 1; border: 2px solid var(--shop-brand-color); }

.modal-details { flex: 1; min-width: 0; }
#modal-name { font-size: 2rem; margin: 0 0 0.5rem 0; }
.modal-price { font-size: 1.5rem; color: var(--shop-brand-color); font-family: var(--font-bold); margin: 0 0 1rem 0; }
.license-options { margin-bottom: 1rem; }
.modal-description { line-height: 1.7; color: #555; margin: 0 0 1.5rem 0; }
.modal-details h3 { font-size: 1.2rem; margin: 2rem 0 1rem 0; border-bottom: 1px solid #eee; padding-bottom: 0.5rem; }
.modal-features { list-style: none; padding: 0; }
.modal-features li { margin-bottom: 0.5rem; }
.modal-tech-stack { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modal-tech-stack span { background: #eee; padding: 5px 10px; border-radius: 5px; font-size: 0.9rem; }
.modal-buy-actions { margin-top: 2rem; }

/* --- 6. Notices & Responsive Design --- */
.error-notice, .info-notice {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
}
.error-notice {
    background-color: rgba(255, 59, 48, 0.05);
    border: 1px dashed rgba(255, 59, 48, 0.3);
    color: #c70000;
}
.info-notice {
    color: var(--shop-text-secondary);
}


@media (max-width: 992px) {
    .modal-body {
        flex-direction: column;
    }
}
@media (max-width: 768px) {
    .shop-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}