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

:root {
    --primary-color: #3d5c2d;
    --primary-light: #4a6b3a;
    --primary-dark: #2d4520;
    --accent-color: #5a8a45;
    --bg-color: #f5f5f0;
    --panel-bg: #fafaf8;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0d8;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

/* ===== 导航栏 ===== */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-brand i {
    font-size: 1.5rem;
    color: #a8d5a2;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-item {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item i {
    font-size: 0.9rem;
}

.nav-lang .lang-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-lang .lang-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== 主容器 ===== */
.main-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* ===== 左侧控制面板 ===== */
.control-panel {
    width: 320px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
}

/* 导出按钮组 */
.export-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.export-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 4px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    gap: 4px;
}

.export-btn i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.export-btn span {
    line-height: 1.3;
    text-align: center;
}

.export-btn.pdf {
    background: #3d5c2d;
    color: white;
}

.export-btn.svg {
    background: #8a9a7a;
    color: white;
}

.export-btn.png {
    background: #7a9aaa;
    color: white;
}

.export-btn.docx {
    background: #6a7ab8;
    color: white;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    filter: brightness(1.1);
}

/* 控制区块 */
.control-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

.control-section h3 i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.control-section label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 6px;
}

.control-section select,
.control-section input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s;
}

.control-section select:focus,
.control-section input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(61,92,45,0.1);
}

.control-section select {
    cursor: pointer;
}

/* 输入行 */
.input-row {
    margin-top: 12px;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.input-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.recommend-btn {
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.recommend-btn:hover {
    background: var(--primary-dark);
}

/* 边距输入 */
.margin-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.margin-inputs .input-group {
    margin-bottom: 0;
}

.margin-inputs input {
    width: 100%;
}

/* 复选框 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* 颜色选择器 */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
}

/* 设置导入导出 */
.settings-io {
    display: flex;
    gap: 12px;
}

.settings-btn {
    flex: 1;
    padding: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: all 0.2s;
}

.settings-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* ===== 右侧预览区 ===== */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e8e8e5;
    padding: 20px;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

#zoomLevel {
    font-size: 0.9rem;
    color: var(--text-light);
    min-width: 50px;
    text-align: center;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
}

.paper-preview {
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

#paperSvg {
    display: block;
}

/* ===== 底部信息区 ===== */
.footer {
    background: var(--panel-bg);
    border-top: 1px solid var(--border-color);
    padding: 40px 24px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

.footer-section h3 i {
    color: var(--primary-color);
}

.footer-section p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.6;
}

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

.footer-section a:hover {
    text-decoration: underline;
}

.tip-item {
    margin-bottom: 16px;
}

.tip-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip-item h4 i {
    color: var(--accent-color);
}

.tip-item p {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.footer-links {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.footer-links a {
    font-size: 0.85rem;
}

.product-links {
    list-style: none;
}

.product-links li {
    margin-bottom: 8px;
}

.product-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.product-links i {
    color: var(--accent-color);
    width: 16px;
}

/* ===== 推荐产品弹窗 ===== */
.recommendation-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 200;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

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

.popup-header {
    background: var(--primary-color);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.popup-content {
    padding: 16px;
}

.popup-content > p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.product-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.product-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.product-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.try-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.try-btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .nav-links {
        display: none;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        max-height: none;
        position: relative;
        top: 0;
    }
    
    .export-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .recommendation-popup {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: 16px;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar,
    .control-panel,
    .preview-toolbar,
    .footer,
    .recommendation-popup {
        display: none !important;
    }
    
    .preview-area {
        background: white;
        padding: 0;
    }
    
    .paper-preview {
        box-shadow: none;
    }
}
