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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* 容器 */
.container {
    max-width: 700px;
    margin: 0 auto;
}

/* 标题 */
h1 {
    color: white;
    text-align: center;
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 16px;
    margin-bottom: 30px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #eee;
}

/* 输入框行 */
.input-row {
    display: flex;
    gap: 10px;
}

/* 输入框 */
input[type="text"],
input[type="password"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #667eea;
}

/* 下拉框 */
select {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: #667eea;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-gray {
    background: #f0f0f0;
    color: #333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
}

/* 提示文字 */
.hint {
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

.hint a {
    color: #667eea;
    text-decoration: none;
}

.hint a:hover {
    text-decoration: underline;
}

/* 状态消息 */
#keyStatus {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

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

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

/* ========== 上传区域 ========== */
.upload-box {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-box:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.upload-box.dragover {
    border-color: #667eea;
    background: #e8e8ff;
    border-style: solid;
}

.upload-content {
    pointer-events: none;
}

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

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.upload-formats {
    font-size: 12px;
    color: #999;
    background: #eee;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* 预览容器 */
#previewContainer {
    display: none;
    margin-top: 20px;
}

#previewContainer.show {
    display: block;
}

/* 预览网格 */
#previewGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

/* 预览项目 */
.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f0f0f0;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 26px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.preview-item .delete-btn:hover {
    background: #cc0000;
}

.preview-item .img-number {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 进度区域 */
#progressBox {
    display: none;
    margin-top: 20px;
}

#progressBox.show {
    display: block;
}

.progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.3s;
}

#progressText {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

/* 结果卡片 */
#resultCard {
    display: none;
}

#resultCard.show {
    display: block;
}

.result-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#resultText {
    width: 100%;
    min-height: 280px;
    padding: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    resize: vertical;
    font-family: inherit;
    outline: none;
}

#resultText:focus {
    border-color: #667eea;
}

#resultText.editing {
    background: #fffbeb;
    border-color: #f59e0b;
}

.char-count {
    text-align: right;
    color: #999;
    font-size: 13px;
    margin-top: 10px;
}

/* 导出卡片 */
#exportCard {
    display: none;
}

#exportCard.show {
    display: block;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
}

/* 页脚 */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    padding: 30px 20px;
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 22px;
    }

    .card {
        padding: 18px;
    }

    .input-row {
        flex-direction: column;
    }

    .upload-box {
        padding: 40px 15px;
        min-height: 180px;
    }

    .upload-icon {
        font-size: 48px;
    }

    #previewGrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}
