/* =========================================
   基础重置与全局样式
   ========================================= */
* {
    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-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* =========================================
   头部导航
   ========================================= */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
}

/* =========================================
   主内容区域
   ========================================= */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 160px);
}

.create-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #2d3748;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

/* =========================================
   表单区域
   ========================================= */
.form-section {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    height: fit-content;
}

.gallery-form .form-group {
    margin-bottom: 25px;
}

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

.required {
    color: #e53e3e;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* 主题选择器 */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.theme-option {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.theme-option:hover {
    border-color: #667eea;
}

.theme-option.active {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

.theme-preview {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.theme-default {
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
}

.theme-dark {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.theme-colorful {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.theme-minimal {
    background: #ffffff;
    border: 1px solid #cbd5e0;
}

.theme-option span {
    font-size: 14px;
    color: #4a5568;
}

/* 表单操作按钮 */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

.btn-secondary:hover {
    background-color: #cbd5e0;
}

/* =========================================
   上传区域
   ========================================= */
.upload-section {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafbfc;
    position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.03);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 14px;
    color: #a0aec0;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* 图片预览网格 */
.image-preview-container {
    margin-top: 30px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.preview-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1;
    background-color: #f5f7fa;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.preview-item:hover img {
    transform: scale(1.05);
}

.preview-item .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    background-color: rgba(229, 62, 62, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.preview-item:hover .remove-btn {
    opacity: 1;
}

.preview-item .caption-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    border: none;
    color: white;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-item:hover .caption-input {
    opacity: 1;
}

/* 上传操作按钮 */
.upload-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* =========================================
   底部
   ========================================= */
.footer {
    background-color: #2d3748;
    color: #a0aec0;
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
}

.modal-message {
    font-size: 16px;
    color: #4a5568;
    text-align: center;
    padding: 20px 0;
}

/* =========================================
   加载动画
   ========================================= */
.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;
    margin-right: 8px;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}