:root {
    --primary-color: #ff6e14;
    --primary-hover: #ff8642;
    --secondary-color: #2c3e50;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    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: var(--text-color);
    background-color: var(--bg-color);
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.header nav {
    display: flex;
    gap: 1rem;
}

.header nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.header nav a:hover,
.header nav a.active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* 主要内容区域 */
.main-content {
    width: 100%;
    flex: 1;
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* 侧边栏样式 */
.sidebar {
    width: 100%;
    flex-shrink: 0;
}

.tool-section {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.tool-section h2 {
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* 文字设置横向排列 */
.text-settings-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.text-settings-group {
    flex: 1;
    min-width: 200px;
    background-color: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.spacing-settings {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.spacing-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.spacing-item {
    flex: 1;
    min-width: 0;
    background-color: rgba(0, 0, 0, 0.02);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.spacing-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.tool-group {
    margin-bottom: 1rem;
}

/* 位置设置和特效设置并排 */
.settings-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.settings-column {
    flex: 1;
    min-width: 200px;
}

/* 确保位置设置和特效设置的高度一致 */
.settings-column.tool-section {
    display: flex;
    flex-direction: column;
}

/* 调整位置网格的样式 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.position-grid button {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--light-bg);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.position-grid button:hover {
    background-color: var(--hover-color);
}

.position-grid button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tool-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.tool-group input[type="text"],
.tool-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.3s ease;
}

.tool-group input[type="text"]:focus,
.tool-group input[type="number"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

.tool-group input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius);
}

.tool-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.size-value,
.opacity-value {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 位置网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.position-grid button {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.position-grid button:hover,
.position-grid button.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* 复选框样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* 主要内容区样式 */
.content-area {
    flex: 1;
}

/* 上传和预览区域容器 - 现在位于底部 */
.upload-preview-container {
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 0rem;
    padding: 0 1rem;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* 上传区域样式 */
.upload-section {
    flex: 1;
    min-width: 300px;
}

.upload-area {
    background-color: var(--white);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    height: 100%;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-content {
    pointer-events: none;
}

.upload-content img {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
}

.upload-content h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-light);
}

/* 预览区域样式 */
.preview-section {
    flex: 2;
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    max-height: 600px;
    overflow-y: auto;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background-color: var(--white);
    padding: 0.5rem 0;
    z-index: 1;
}

.preview-header h2 {
    color: var(--secondary-color);
}

.download-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
}

.download-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.download-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

@keyframes spinner {
    to {transform: rotate(360deg);}
}

.download-btn.loading::before {
    content: '';
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--white);
    animation: spinner 0.6s linear infinite;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.preview-item:hover {
    transform: translateY(-5px);
}

.preview-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #f8f9fa;
}

.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    font-size: 0.9rem;
}

.delete-button {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.preview-item:hover .delete-button {
    opacity: 1;
    transform: scale(1);
}

.delete-button:hover {
    background: #ff4d4d;
    transform: scale(1.1);
}

/* 页脚样式 */
.footer {
    background-color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 0;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* 上传和预览区域与页脚之间的间距 */
.upload-preview-container {
    margin-bottom: 1rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-section h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.footer-section p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
    
    .text-settings-container {
        flex-direction: column;
    }
    
    .text-settings-group {
        min-width: 100%;
    }
    
    .settings-row {
        flex-direction: column;
    }
    
    .settings-column {
        min-width: 100%;
    }
    
    /* 上传和预览区域在中等屏幕上垂直排列 */
    .upload-preview-container {
        flex-direction: column;
    }
    
    .upload-section {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .preview-section {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
    
    /* 保持预览区域为3列 */
    .preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .preview-image {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tool-section {
        padding: 1rem;
    }

    .upload-area {
        padding: 1rem;
    }
    
    /* 在非常小的屏幕上保持2列 */
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-image {
        height: 120px;
    }
}