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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 顶部导航栏 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
}

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

.nav-link {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #667eea;
}

/* 主要工作区 */
.main {
    padding: 2rem 0;
    flex: 1;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* 左侧输入面板 */
.input-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.panel-section h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* 表单控件 */
.form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.type-description {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.char-count {
    color: #6c757d;
}

.validation-status {
    font-weight: 500;
}

.validation-status.valid {
    color: #28a745;
}

.validation-status.invalid {
    color: #dc3545;
}

/* 批量处理区域 */
.batch-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* 样式设置网格 */
.style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.style-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.style-item label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.color-picker {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 导出控件 */
.export-controls {
    margin-top: 20px;
}

.export-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.export-format,
.export-quality {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.export-format label,
.export-quality label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.export-format select,
.export-quality select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

/* 工具控件 */
.tool-controls {
    margin-top: 20px;
}

.tool-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-actions .btn-danger {
    background-color: #dc3545;
    color: white;
}

.tool-actions .btn-danger:hover {
    background-color: #c82333;
}

.tool-actions .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.tool-actions .btn-secondary:hover {
    background-color: #5a6268;
}

.tool-actions .btn-info {
    background-color: #17a2b8;
    color: white;
}

.tool-actions .btn-info:hover {
    background-color: #138496;
}

/* 右侧预览面板 */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.preview-header h3 {
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #e9ecef;
}

#zoomLevel {
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    min-width: 40px;
    text-align: center;
}

/* 预览容器 */
.preview-container {
    flex: 1;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.preview-window {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#barcodeCanvas {
    max-width: 100%;
    height: auto;
}



/* 预览信息 */
.preview-info {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.status-success {
    color: #28a745;
    font-weight: 500;
}

.status-error {
    color: #dc3545;
    font-weight: 500;
}

/* 底部工具栏 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 0;
    text-align: center;
}

.toolbar {
    display: none;
}

.copyright {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    text-align: center;
    width: 100%;
}

.copyright p {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
    text-align: center;
}

.export-section, .batch-export-section, .settings-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.export-section h4, .batch-export-section h4 {
    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.export-controls, .batch-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.settings-section {
    flex-direction: row;
    align-items: center;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-primary {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

#batchCount {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

/* 模态框 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .workspace {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .export-controls, .batch-controls, .settings-section {
        justify-content: center;
    }
    
    .style-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .template-controls {
        flex-direction: column;
    }
    
    .template-controls .form-select {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .workspace {
        padding: 1rem;
    }
    
    .panel-section {
        padding: 1rem;
    }
    
    .preview-container {
        padding: 1rem;
        min-height: 200px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 1rem;
    }
}

/* 动画效果 */
.preview-window {
    transition: all 0.3s ease;
}

.preview-window:hover {
    transform: scale(1.02);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 成功/错误消息 */
.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}