/* * CloudCard 样式表
 * 这是一个用于所有页面的中央样式表。
 */

/* 1. CSS 变量 (主题) */
:root {
    --primary-color: #3b82f6; /* 蓝色 */
    --primary-color-dark: #2563eb;
    --secondary-color: #10b981; /* 绿色 */
    --background-color: #f8fafc; /* 浅灰色背景 */
    --card-background: #ffffff;
    --text-color: #334155; /* 深灰字 */
    --text-light: #64748b; /* 浅灰字 */
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* 暗黑模式 (可选, 待实现) */
/*
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0b1120;
        --card-background: #1e293b;
        --text-color: #e2e8f0;
        --text-light: #94a3b8;
        --border-color: #334155;
    }
}
*/

/* 2. 全局重置和基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-color-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3 {
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

/* 3. 布局容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.section {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* 4. 头部和导航栏 */
.header {
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-light);
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

/* 5. 英雄部分 (首页) */
.hero {
    background-color: var(--primary-color);
    color: white;
    padding: 5rem 1rem;
    text-align: center;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* 6. 按钮 */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.button-primary {
    background-color: var(--primary-color);
    color: white;
}
.button-primary:hover {
    background-color: var(--primary-color-dark);
    color: white;
    box-shadow: var(--shadow-md);
}
.button:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
}

.button-secondary {
    background-color: var(--card-background);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.button-secondary:hover {
    background-color: #f4f8ff;
    color: var(--primary-color);
}

.button-full {
    width: 100%;
}

/* 7. 卡片 (商品, 分类, 文章) */
/* 分类卡片 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
}

/* 商品卡片 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
}
.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}
.product-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.product-title {
    font-size: 1.25rem;
    font-weight: 600;
}
.product-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: auto;
    margin-bottom: 1rem;
}

/* 8. 商品详情页 */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 768px) {
    .product-detail-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.product-detail-image img {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.product-price-large {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.product-description {
    color: var(--text-light);
}

/* 规格选择 */
.variants-container {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.variant-option {
    display: block;
}
.variant-option input[type="radio"] {
    display: none; /* 隐藏原生 radio */
}
.variant-option label {
    display: block;
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}
.variant-option input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background-color: #f4f8ff;
    color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* 9. 支付页面 */
.payment-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    text-align: center;
}
.order-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}
#qr-code-container {
    margin: 1.5rem auto;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: inline-block;
}
#qr-code-container img {
    width: 200px;
    height: 200px;
}
.card-secret {
    background: var(--background-color);
    border: 1px dashed var(--primary-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: monospace;
    border-radius: var(--border-radius);
}
.payment-status {
    padding: 1rem 0;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 1.5rem auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 10. 文章页 */
.article-list {
    display: grid;
    gap: 1.5rem;
}
.article-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.article-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.article-title {
    color: var(--text-color);
}
.article-summary {
    color: var(--text-light);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}
.article-date {
    font-size: 0.9rem;
    color: var(--text-light);
}
/* 文章详情 */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
}
.article-title-large {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.article-meta {
    color: var(--text-light);
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}
.article-content {
    line-height: 1.7;
}
.article-content h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}
.article-content p {
    margin-bottom: 1.25rem;
}
.article-content code {
    background: var(--background-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

/* 11. 页脚 */
.footer {
    background-color: var(--card-background);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-light);
}

/* 12. 辅助类 */
.error-message {
    color: #dc2626;
    background: #ffebeB;
    padding: 1rem;
    border-radius: var(--border-radius);
}

/* 13. 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        /* 在移动端可以考虑隐藏或改为汉堡菜单 */
        display: none;
    }
    .hero h1 {
        font-size: 2.25rem;
    }
    .section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .product-grid, .category-grid {
        gap: 1rem;
    }
}
