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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #06b6d4 100%);
    min-height: 100vh;
    color: #333;
}

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

/* 头部样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    color: white;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 3.5rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

.brand-text {
    text-align: left;
}

.brand-text h1 {
    font-size: 2.2rem;
    margin-bottom: 3px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    font-weight: 700;
    letter-spacing: 2px;
}

.brand-text p {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 300;
    letter-spacing: 3px;
}

/* 用户菜单 */
.user-menu {
    position: relative;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.user-name::after {
    content: '▼';
    font-size: 0.7rem;
    opacity: 0.7;
}

.user-name:hover {
    background: rgba(255,255,255,0.25);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    overflow: hidden;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: block;
    padding: 12px 20px;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.user-dropdown a:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.user-dropdown .divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 0;
}

.user-dropdown .logout {
    color: #ef4444;
}

.user-dropdown .logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* 主要区域样式 */
main {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
    margin-bottom: 20px;
}

section {
    margin-bottom: 30px;
}

section h2 {
    font-size: 1.3rem;
    color: #4a5568;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

/* 输出设置区 */
.output-settings {
    margin-bottom: 30px;
}

/* 板块管理区 */
.section-manager {
    margin-bottom: 30px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(237, 137, 54, 0.4);
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-danger {
    background: #fc8181;
    color: white;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: #f56565;
}

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

/* 板块管理区 */
.section-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.sections-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.section-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.section-card.dragging {
    opacity: 0.5;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.section-drag-handle {
    cursor: move;
    color: #a0aec0;
    font-size: 1.2rem;
}

.section-title-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
}

.section-title-input:focus {
    outline: none;
    border-color: #2563eb;
}

.section-actions {
    display: flex;
    gap: 8px;
}

.section-content {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.section-content:focus {
    outline: none;
    border-color: #2563eb;
}

/* 输出设置区 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-item label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

.setting-item input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.setting-item input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #f7fafc;
}

/* 表单样式 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

/* 操作按钮区 */
.actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

/* 预览区 */
.preview-section {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
}

.preview-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 30px;
    min-height: 200px;
    line-height: 1.8;
}

.preview-content h1, .preview-content h2, .preview-content h3 {
    color: #2d3748;
    margin: 20px 0 10px;
}

.preview-content p {
    margin-bottom: 15px;
    color: #4a5568;
}

/* 模板弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #a0aec0;
}

.close-btn:hover {
    color: #4a5568;
}

.template-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.template-item {
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-item:hover {
    border-color: #667eea;
    background: #f7fafc;
    transform: translateX(5px);
}

.template-item h4 {
    color: #2d3748;
    margin-bottom: 8px;
}

.template-item p {
    color: #718096;
    font-size: 0.9rem;
}

/* 页脚 */
footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    padding: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
    }
    
    .brand {
        flex-direction: column;
        gap: 10px;
    }
    
    .brand-text {
        text-align: center;
    }
    
    .brand-text h1 {
        font-size: 1.8rem;
    }
    
    .brand-text p {
        font-size: 0.9rem;
    }
    
    .user-menu {
        width: 100%;
    }
    
    .user-name {
        justify-content: center;
    }
    
    .user-dropdown {
        right: 50%;
        transform: translateX(50%) translateY(-10px);
    }
    
    .user-menu:hover .user-dropdown {
        transform: translateX(50%) translateY(0);
    }
    
    main {
        padding: 20px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn-large {
        width: 100%;
        justify-content: center;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 消息提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #48bb78;
}

.toast.error {
    background: #f56565;
}

.toast.info {
    background: #4299e1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
