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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== 按钮样式 ==================== */
.btn-primary {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

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

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

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

.user-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.free-count {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.admin-link {
    color: var(--warning-color);
    font-weight: 500;
}

/* ==================== Hero区域 ==================== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 80px 0;
    color: white;
}

.hero-content {
    text-align: center;
}

.hero-content h2 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero-content p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 32px;
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    gap: 12px;
}

.search-box input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    outline: none;
}

.search-box button {
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.search-box button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== 主要内容 ==================== */
.main {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h3 {
    font-size: 24px;
    font-weight: 600;
}

.filter-buttons button {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-buttons button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.back-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ==================== 提示词卡片 ==================== */
.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.prompt-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.prompt-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.prompt-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.featured {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    color: white;
}

.badge.free {
    background: linear-gradient(135deg, var(--success-color), #34d399);
    color: white;
}

.prompt-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.prompt-category {
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.prompt-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-content {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.prompt-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.prompt-price {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== 详情页 ==================== */
.detail-view {
    padding-top: 20px;
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.detail-main h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
}

.detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.category-tag {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: 500;
}

.detail-desc,
.preview-section,
.full-content-section {
    margin-bottom: 32px;
}

.detail-desc h3,
.preview-section h3,
.full-content-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.detail-desc p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.preview-box,
.full-content-box {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--radius-md);
    line-height: 1.8;
    white-space: pre-wrap;
}

.full-content-box pre {
    margin: 0;
    font-family: inherit;
    white-space: pre-wrap;
}

.copy-btn {
    margin-top: 16px;
}

.detail-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.price-box {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.price-box .price {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.free-hint {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ==================== 我的提示词/订单 ==================== */
.my-prompts-view,
.my-orders-view {
    padding-top: 20px;
}

.purchase-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.orders-table {
    width: 100%;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.orders-table th,
.orders-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.orders-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 14px;
}

.orders-table td {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.paid {
    background: var(--success-color);
    color: white;
}

.status-badge.pending {
    background: var(--warning-color);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
}

.pagination button {
    padding: 10px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* ==================== 弹窗 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--primary-color);
    font-weight: 500;
}

/* ==================== Toast消息 ==================== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideDown 0.3s ease;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================== 底部 ==================== */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding: 40px 0;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-section p,
.footer-section a {
    color: var(--text-secondary);
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 968px) {
    .nav {
        display: none;
    }
    
    .hero-content h2 {
        font-size: 32px;
    }
    
    .detail-content {
        grid-template-columns: 1fr;
    }
    
    .detail-sidebar {
        position: static;
        order: -1;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .user-actions {
        gap: 8px;
    }
    
    .free-count,
    .user-name {
        display: none;
    }
    
    .hero-content h2 {
        font-size: 24px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .prompts-grid {
        grid-template-columns: 1fr;
    }
    
    .orders-table {
        font-size: 12px;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 12px 8px;
    }
}
