/* 导入本地字体 */
@import url('./local-fonts.css');

/* 定义CSS变量 - 现代化设计系统 */
:root {
    /* 色彩系统 - 更现代的配色 */
    --primary-color: #1a1a1a;          /* 主色（深黑） */
    --secondary-color: #f8f9fa;        /* 辅色（浅灰） */
    --background-color: #ffffff;       /* 背景色（纯白） */
    --surface-color: #ffffff;          /* 表面色 */
    --border-color: #e9ecef;           /* 边框色 */
    --text-primary: #1a1a1a;           /* 主要文字 */
    --text-secondary: #6c757d;         /* 次要文字 */
    --text-muted: #adb5bd;             /* 提示文字 */
    --accent-color: #007bff;           /* 强调色（蓝色） */
    --success-color: #28a745;          /* 成功色 */
    --warning-color: #ffc107;          /* 警告色 */
    --danger-color: #dc3545;           /* 危险色 */
    
    /* 字体系统 */
    --font-title: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    /* 边距和大小 */
    --container-width: 1400px;
    --sidebar-width: 400px;
    --border-radius: 12px;
    --border-radius-small: 8px;
    --border-radius-large: 16px;
    
    /* 阴影系统 */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 过渡动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f0f2f5 0%, #e8eaf6 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    margin: 0 auto;
}

.main .container {
    padding: 0;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.logo a:hover,
.logo a:active,
.logo a:visited {
  color: inherit;
  text-decoration: none;
}

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

.nav-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s ease;
}

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

/* 主要内容区域 */
.main {
    flex: 1;
    padding: 0;
}

.editor-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
    gap: 0;
    align-items: start;
    min-height: 85vh;
    max-width: 100%;
    margin: 0;
}

/* 左侧栏和右侧栏 */
.left-sidebar,
.right-sidebar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border-radius: 0;
    padding: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

/* 移除侧栏hover效果 */

/* 侧边栏区块 */
.sidebar-section {
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    transition: all var(--transition-normal);
    backdrop-filter: none;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}


/* 侧边栏标题 */
.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-family: var(--font-title);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.sidebar-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    flex-shrink: 0;
}

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

.input-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.text-input {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: all var(--transition-fast);
    background-color: var(--surface-color);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.char-count {
    text-align: right;
    font-size: 14px;
    color: var(--neutral-color);
    margin-top: 0.25rem;
}

/* 样式控制区域 */
.style-controls {
    margin-bottom: 1.5rem;
}

/* 控制组间距优化 */
.sidebar-section .control-group {
    margin-bottom: 1.2rem;
}

/* 边距控件样式 */
.margin-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.margin-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.margin-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

/* 位置控件样式 */
.position-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.position-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.position-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-group {
    margin-bottom: 1rem;
}

.control-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.font-select,
.background-select,
.export-format,
.canvas-ratio {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 13px;
    background-color: var(--surface-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.font-select:focus,
.background-select:focus,
.export-format:focus,
.canvas-ratio:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 文件上传控件样式 */
.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 13px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background-color: var(--secondary-color);
    color: var(--text-secondary);
}

.file-input:hover {
    border-color: var(--accent-color);
    background-color: rgba(0, 123, 255, 0.05);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 12px;
}

/* 现代化滑块样式 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    transition: background var(--transition-fast);
    margin: 8px 0;
}

.slider:hover {
    background: #dee2e6;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    border: 2px solid white;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    border: 2px solid white;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* 滑块值显示 */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-container .slider {
    flex: 1;
    margin: 0;
}

.slider-value {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 50px;
    text-align: right;
    font-family: var(--font-mono);
    background: var(--secondary-color);
    padding: 4px 8px;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-color);
}

/* 颜色选择器 */
.color-picker {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker input[type="color"] {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-picker input[type="color"]:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
    position: relative;
}

.color-preset:hover {
    border-color: var(--accent-color);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.color-preset:active {
    transform: scale(0.95);
}

/* 预设按钮组 */
.preset-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--secondary-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.preset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.3s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.preset-btn:hover::before {
    left: 100%;
}

.preset-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.preset-btn:active {
    transform: translateY(0);
}

/* 现代化按钮样式 */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #0056b3);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, var(--accent-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #1e7e34, var(--success-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    box-shadow: none;
}

.btn-outline:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

.btn-outline.active {
    background: linear-gradient(135deg, var(--accent-color), #0056b3);
    border-color: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-buttons .btn {
    width: 100%;
}

/* 分页控制样式 */
.page-controls-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.page-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 80px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.page-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.page-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-info {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0 1rem;
    min-width: 100px;
    text-align: center;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 0.5rem 1rem;
}

/* 预览区域 */
.preview-section {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    transition: none;
    overflow: hidden;
}

.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}


.canvas-container {
    position: relative;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    flex: 1;
    padding: 1rem;
}

#preview-canvas {
    max-width: 100%;
    max-height: 75vh;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    background-color: white;
    transition: all var(--transition-normal);
}

#preview-canvas:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 画布比例样式 */
.canvas-a4 {
    width: 480px;
    height: 680px;
}

.canvas-square {
    width: 480px;
    height: 480px;
}

.canvas-landscape {
    width: 640px;
    height: 360px;
}

.canvas-portrait {
    width: 360px;
    height: 640px;
}

.canvas-post {
    width: 480px;
    height: 600px;
}

.canvas-story {
    width: 360px;
    height: 640px;
}



/* 响应式设计 */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 280px 1fr 280px;
        gap: 1rem;
    }
    
    .left-sidebar,
    .right-sidebar {
        padding: 1rem;
    }
    
    .sidebar-title {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .left-sidebar,
    .right-sidebar {
        max-height: none;
        overflow-y: visible;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    /* 移动端画布适配 */
    .canvas-container {
        min-height: 300px;
        padding: 0.5rem;
    }
    
    .canvas-a4 {
        width: 280px;
        height: 396px;
    }
    
    .canvas-square {
        width: 300px;
        height: 300px;
    }
    
    .canvas-landscape {
        width: 320px;
        height: 180px;
    }
    
    .canvas-portrait {
        width: 180px;
        height: 320px;
    }
    
    .canvas-post {
        width: 300px;
        height: 300px;
    }
    
    .canvas-story {
        width: 180px;
        height: 320px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .left-sidebar,
    .right-sidebar,
    .preview-section {
        padding: 1rem;
    }
    
    .logo {
        font-size: 24px;
    }
    
    .sidebar-title {
        font-size: 16px;
        margin-bottom: 0.5rem;
    }
    
    .text-input {
        min-height: 100px;
    }
}

/* 加载状态 */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* 手写字体样式 */
.handwriting-font {
    font-family: 'handwriting', serif;
    font-variant-ligatures: none;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 隐藏侧边栏滚动条 */
.left-sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.left-sidebar::-webkit-scrollbar-thumb,
.right-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
}

.left-sidebar::-webkit-scrollbar-thumb:hover,
.right-sidebar::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* 对于Firefox */
.left-sidebar,
.right-sidebar {
    scrollbar-width: none;
}

/* 侧栏内容区域 */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

/* 右侧栏导出按钮 */
.sidebar-export-btn {
    margin-top: auto;
    padding: 1.5rem 0 0 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    flex-shrink: 0;
}

.export-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.export-button:active {
    transform: translateY(0);
}

.export-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.export-button svg {
    transition: transform var(--transition-normal);
}

.export-button:hover:not(:disabled) svg {
    transform: scale(1.1);
} 