/* ========================================
   全局样式
   ======================================== */

:root {
    --primary-color: #1f6f4a;
    --primary-hover: #185a3c;
    --secondary-color: #6b7280;
    --success-color: #1f6f4a;
    --warning-color: #b45309;
    --danger-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --bg-white: #ffffff;
    --bg-gray-50: #f8fafc;
    --bg-gray-100: #f1f5f9;
    --border-color: #e2e8f0;
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* ========================================
   导航栏
   ======================================== */

.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

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

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

/* ========================================
   Hero Section
   ======================================== */

.hero-section {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 3rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   上传区域
   ======================================== */

.upload-section {
    padding: 2rem 0;
    max-width: 900px;
    margin: 0 auto;
}

.upload-wrapper {
    margin-bottom: 2rem;
    position: relative;
}

.upload-area {
    background: var(--bg-gray-50);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f3f7f4;
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #e7f1eb;
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.upload-size {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
}

/* ========================================
   预览容器
   ======================================== */

.preview-container {
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

#previewImage {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.image-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: var(--bg-gray-50);
    border-radius: var(--radius-sm);
}

/* ========================================
   设置面板
   ======================================== */

.settings-panel {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin: 0 auto;
}

.settings-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.setting-label svg {
    color: var(--primary-color);
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    color: var(--text-tertiary);
    margin-left: 0.25rem;
    position: relative;
    transition: color 0.2s;
}

.tooltip-icon:hover {
    color: var(--primary-color);
}

.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--text-primary);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: normal;
    width: 280px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.tooltip-icon::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip-icon:hover::after,
.tooltip-icon:hover::before {
    opacity: 1;
}

.tooltip-icon:hover::after {
    transform: translateX(-50%) translateY(-12px);
}

.select-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
}

.select-input:hover {
    border-color: var(--primary-color);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.12);
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-gray-100);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(31, 111, 74, 0.12);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    gap: 0.5rem;
}

.slider-labels small {
    display: block;
    font-size: 0.65rem;
    color: var(--text-tertiary);
    margin-top: 0.125rem;
}

.recommend-label {
    text-align: center;
    color: var(--primary-color);
}

.recommend-label strong {
    color: var(--primary-color);
    font-size: 0.8rem;
}

.confidence-tips {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f3f7f4;
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ========================================
   按钮
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--bg-gray-100);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-gray-100);
    transform: translateY(-2px);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--primary-color);
    background: var(--bg-gray-50);
}

.btn-large {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    margin-top: 1rem;
}

/* ========================================
   加载状态
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-gray-100);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 1.5rem;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* ========================================
   结果展示
   ======================================== */

.result-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

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

.result-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
}

.export-dropdown {
    position: relative;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 10;
}

.export-menu.active {
    display: block;
}

.export-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.export-item:hover {
    background: var(--bg-gray-50);
    color: var(--primary-color);
}

.export-item svg {
    color: var(--text-secondary);
}

/* ========================================
   统计卡片
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-icon-1 {
    background: #2f6f3e;
}

.stat-icon-2 {
    background: #2f6f3e;
}

.stat-icon-3 {
    background: #7a4b1f;
}

.stat-icon-4 {
    background: #b45309;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   结果内容
   ======================================== */

.result-content {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.result-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-gray-50);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.tab-btn.active {
    background: var(--bg-white);
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

.result-textarea {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--text-primary);
    resize: vertical;
}

.result-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.12);
}

/* ========================================
   内容补充区（使用指南 / 示例 / FAQ / 工具说明）
   ======================================== */

.content-section {
    padding: 3.5rem 0 0;
    max-width: 900px;
    margin: 0 auto;
}

.content-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.content-steps {
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.content-steps li {
    margin: 0.6rem 0;
}

.content-steps ul {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

.content-example + .content-example {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-color);
}

.content-example h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.content-example p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.content-faq dt {
    font-weight: 700;
    margin-top: 1rem;
    color: var(--text-primary);
}

.content-faq dd {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.content-note {
    margin-top: 0.75rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.result-lines {
    max-height: 600px;
    overflow-y: auto;
}

.line-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.line-item:hover {
    background: var(--bg-gray-50);
}

.line-number {
    color: var(--text-tertiary);
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

.line-text {
    flex: 1;
    color: var(--text-primary);
}

/* ========================================
   功能特点
   ======================================== */

.features-section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   页脚
   ======================================== */

.footer {
    background: var(--bg-gray-50);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    color: var(--text-secondary);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.footer-links h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.links-grid {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.footer-info {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer-info p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.footer-desc {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ========================================
   Toast 通知
   ======================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

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

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1024px) {
    .upload-section {
        max-width: 100%;
    }
    
    .settings-panel {
        max-width: 100%;
    }
    
    .preview-container {
        max-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .links-grid {
        flex-direction: column;
    }
    
    .footer-info {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 2rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
