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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

.container {
    min-height: 100vh;
}

/* ===== 页面切换 ===== */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* ===== 按钮样式 ===== */
.btn-primary,
.btn-secondary,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-color);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 4px 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-icon:hover {
    background-color: var(--bg-color);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

/* ===== 登录页面 ===== */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    text-align: center;
    color: white;
    padding: 40px;
}

.login-box h1 {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-box .subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
}

#wechat-login {
    background-color: white;
    color: #07c160;
    font-size: 18px;
    padding: 16px 40px;
}

#wechat-login:hover {
    background-color: #f0f0f0;
}

#wechat-login .icon {
    width: 24px;
    height: 24px;
}

/* ===== 头部导航 ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

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

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

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

/* ===== 上传区域 ===== */
.main {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.upload-section {
    text-align: center;
}

.upload-section h2 {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-section .desc {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--card-bg);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background-color: #eef2ff;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.upload-icon {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    color: var(--primary-color);
}

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

/* ===== 文件预览 ===== */
.file-preview {
    margin-top: 24px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.file-icon {
    width: 40px;
    height: 40px;
    fill: var(--primary-color);
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.file-name {
    font-weight: 500;
}

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

#start-diagnose {
    margin-top: 32px;
    min-width: 200px;
}

/* ===== 加载动画 ===== */
.loading-section {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-section p {
    font-size: 20px;
    font-weight: 500;
}

.loading-section .sub-text {
    color: var(--text-secondary);
}

/* ===== 评分卡片 ===== */
.score-card {
    display: flex;
    align-items: center;
    gap: 40px;
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.score-circle {
    position: relative;
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-circle circle {
    fill: none;
    stroke-width: 8;
}

.score-circle .bg {
    stroke: var(--border-color);
}

.score-circle .progress {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-text span {
    display: block;
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
}

.score-text small {
    color: var(--text-secondary);
}

.score-summary h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.score-summary p {
    color: var(--text-secondary);
}

/* ===== 分析卡片 ===== */
.analysis-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.card.full-width {
    grid-column: span 2;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header .icon {
    width: 24px;
    height: 24px;
}

.card-header h4 {
    font-size: 18px;
}

.check-list {
    list-style: none;
}

.check-list li {
    padding: 8px 0;
    padding-left: 28px;
    position: relative;
}

.check-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.check-list.positive li::before {
    background-color: var(--success-color);
}

.check-list.negative li::before {
    background-color: var(--danger-color);
}

.number-list {
    list-style: none;
    counter-reset: item;
}

.number-list li {
    padding: 12px 0;
    padding-left: 36px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.number-list li:last-child {
    border-bottom: none;
}

.number-list li::before {
    counter-increment: item;
    content: counter(item);
    position: absolute;
    left: 0;
    top: 10px;
    width: 24px;
    height: 24px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* ===== 操作栏 ===== */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.action-bar .btn-primary .price {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,0.3);
}

/* ===== 优化页面 ===== */
.options-section {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.options-section h2 {
    margin-bottom: 32px;
}

.option-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.option-card {
    padding: 24px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover,
.option-card.selected {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.option-card.selected {
    background-color: #eef2ff;
}

.card-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.option-card h4 {
    margin-bottom: 8px;
}

.option-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group {
    text-align: left;
    margin-bottom: 32px;
}

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

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

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

.price-tag {
    margin-left: 8px;
    padding: 4px 8px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 14px;
}

/* ===== 优化结果 ===== */
.optimize-result {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.result-actions {
    display: flex;
    gap: 12px;
}

.compare-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.resume-panel {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.resume-panel h4 {
    padding: 16px 20px;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.resume-content {
    padding: 20px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
}

.resume-content.optimized {
    background-color: #f0fdf4;
}

.optimize-summary {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.optimize-summary h4 {
    margin-bottom: 16px;
}

.optimize-summary ul {
    list-style: none;
}

.optimize-summary li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.optimize-summary li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.price-display {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.price-display span {
    font-size: 48px;
}

.modal-content .desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.payment-methods {
    margin-bottom: 24px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
}

.payment-option input {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
}

.payment-option input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.wechat-icon {
    width: 24px;
    height: 24px;
    color: #07c160;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 16px;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .score-card {
        flex-direction: column;
        text-align: center;
    }

    .analysis-cards {
        grid-template-columns: 1fr;
    }

    .card.full-width {
        grid-column: span 1;
    }

    .action-bar {
        flex-direction: column;
    }

    .option-cards {
        grid-template-columns: 1fr;
    }

    .compare-view {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        gap: 16px;
    }
}
