/* Frontend Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f8fafc; color: #1e293b; line-height: 1.6; }
a { text-decoration: none; color: #3b82f6; }
a:hover { color: #2563eb; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.logo { font-size: 1.2rem; font-weight: bold; color: #1e293b; }
.site-header nav a { margin-left: 16px; color: #64748b; font-size: 0.9rem; }
.site-header nav a:hover { color: #3b82f6; }

/* Hero */
.hero { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); color: #fff; padding: 60px 0; text-align: center; }
.hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.hero p { color: #94a3b8; margin-bottom: 24px; }
.search-bar { display: flex; max-width: 500px; margin: 0 auto; }
.search-bar input { flex: 1; padding: 12px 16px; border: none; border-radius: 8px 0 0 8px; font-size: 1rem; }
.search-bar input:focus { outline: none; }
.search-bar button { padding: 12px 20px; background: #3b82f6; color: #fff; border: none; border-radius: 0 8px 8px 0; cursor: pointer; font-size: 1rem; }

/* Filters */
.filters { display: flex; align-items: center; gap: 8px; padding: 16px 0; flex-wrap: wrap; }
.filter-btn { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; background: #fff; color: #64748b; border: 1px solid #e2e8f0; transition: all 0.2s; }
.filter-btn:hover, .filter-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.filter-right { margin-left: auto; display: flex; gap: 8px; }

/* Template Grid */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; padding-bottom: 40px; }
.template-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: all 0.2s; display: block; color: inherit; }
.template-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.card-image { position: relative; height: 180px; background: #f1f5f9; overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.no-preview { display: flex; align-items: center; justify-content: center; height: 100%; color: #94a3b8; font-size: 0.9rem; }
.card-platform { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; }
.platform-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 500; }
.platform-tag.wechat { background: #dcfce7; color: #16a34a; }
.platform-tag.douyin { background: #fef9c3; color: #ca8a04; }
.card-body { padding: 14px; }
.card-body h3 { font-size: 1rem; margin-bottom: 4px; }
.card-cat { font-size: 0.8rem; color: #94a3b8; }
.card-desc { font-size: 0.85rem; color: #64748b; margin: 6px 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.price { font-size: 1.1rem; font-weight: bold; color: #10b981; }
.downloads { font-size: 0.8rem; color: #94a3b8; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: #94a3b8; }
.empty-state .btn { margin-top: 12px; }

/* Detail Page */
.breadcrumb { padding: 16px 0; }
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding-bottom: 40px; }
.detail-preview img { width: 100%; border-radius: 12px; }
.platform-tags { margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.cat-tag { display: inline-block; padding: 2px 8px; background: #f1f5f9; border-radius: 4px; font-size: 0.8rem; color: #64748b; }
.detail-info h1 { font-size: 1.5rem; margin-bottom: 12px; }
.detail-price { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.detail-price .price { font-size: 1.8rem; }
.detail-desc { margin-bottom: 24px; }
.detail-desc h3 { font-size: 1rem; margin-bottom: 8px; color: #475569; }
.detail-desc p { color: #64748b; font-size: 0.9rem; line-height: 1.6; }
.action-area { margin-top: 24px; }
.login-hint { color: #94a3b8; font-size: 0.9rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.purchased-notice { color: #16a34a; font-weight: 500; margin-bottom: 12px; }

/* Deploy Guide */
.deploy-guide { font-size: 0.9rem; }
.guide-step { margin-bottom: 20px; padding: 16px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }
.guide-step h4 { margin-bottom: 8px; font-size: 1rem; }
.guide-step ol { padding-left: 20px; color: #475569; }
.guide-step ol li { margin-bottom: 6px; }
.guide-step code { background: #f1f5f9; padding: 1px 6px; border-radius: 3px; font-size: 0.85rem; }
.config-preview { background: #1e293b; color: #e2e8f0; padding: 12px; border-radius: 6px; font-size: 0.8rem; overflow-x: auto; margin-top: 8px; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 0.9rem; border: 1px solid #e2e8f0; background: #fff; color: #475569; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.btn-primary:hover { background: #2563eb; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; border-radius: 4px; border: 1px solid #e2e8f0; cursor: pointer; display: inline-block; }

/* Auth */
.auth-page { display: flex; justify-content: center; padding: 60px 0; }
.auth-box { background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); width: 100%; max-width: 420px; }
.auth-box h1 { text-align: center; margin-bottom: 24px; font-size: 1.3rem; }
.auth-link { text-align: center; margin-top: 16px; font-size: 0.9rem; color: #64748b; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: #475569; margin-bottom: 4px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.9rem; transition: border-color 0.2s; }
.form-group input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Profile */
.profile-card { background: #fff; border-radius: 12px; padding: 24px; display: flex; align-items: center; gap: 16px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.profile-avatar { font-size: 3rem; }
.profile-info h2 { font-size: 1.2rem; }
.profile-info p { color: #64748b; font-size: 0.9rem; }
.profile-links { display: flex; flex-direction: column; gap: 12px; }
.profile-link-card { display: flex; align-items: center; padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); gap: 12px; color: #1e293b; }
.profile-link-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.link-icon { font-size: 1.5rem; }
.link-text { flex: 1; font-size: 0.95rem; }
.link-arrow { color: #94a3b8; font-size: 1.2rem; }

/* Orders */
.order-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.order-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; }
.order-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #f1f5f9; }
.order-no { font-size: 0.8rem; color: #94a3b8; font-family: monospace; }
.order-body { display: flex; align-items: center; padding: 14px; gap: 16px; }
.order-thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; }
.order-tpl-info { flex: 1; display: flex; align-items: center; gap: 12px; }
.order-tpl-info strong { font-size: 0.95rem; }
.order-platform { font-size: 0.8rem; color: #94a3b8; }
.order-amount { font-size: 1.1rem; font-weight: bold; color: #10b981; white-space: nowrap; }
.order-actions { display: flex; gap: 4px; }
.order-footer { padding: 8px 14px; background: #f8fafc; font-size: 0.8rem; color: #94a3b8; }

/* Footer */
.site-footer { text-align: center; padding: 24px 0; color: #94a3b8; font-size: 0.85rem; border-top: 1px solid #e2e8f0; margin-top: 40px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; }
.badge-paid { background: #dcfce7; color: #16a34a; }
.badge-pending { background: #fef9c3; color: #ca8a04; }
.badge-cancelled, .badge-refunded { background: #f1f5f9; color: #64748b; }

/* My templates */
.my-templates .purchased-badge { position: absolute; top: 8px; right: 8px; background: #10b981; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; }
.my-templates .card-footer .btn { flex: 1; text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    .detail-layout { grid-template-columns: 1fr; }
    .template-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .filters { flex-direction: column; align-items: flex-start; }
    .filter-right { margin-left: 0; }
    .hero h1 { font-size: 1.6rem; }
}
