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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 步骤区域样式 */
.step-section {
    padding: 30px 40px;
    border-bottom: 1px solid #e0e0e0;
}

.step-section:last-child {
    border-bottom: none;
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 15px;
}

.step-header h2 {
    font-size: 1.8em;
    color: #333;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

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

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

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

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1.2em;
}

/* 上传区域样式 */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.upload-area.drag-over {
    border-color: #28a745;
    background: #e8f5e9;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.3em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-subtext {
    color: #999;
    margin-bottom: 20px;
}

.upload-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-info p {
    font-size: 1.1em;
    color: #333;
}

#fileCount {
    font-weight: bold;
    color: #667eea;
}

/* 缩略图列表 */
.thumbnail-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.thumbnail-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

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

.thumbnail-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.thumbnail-item .thumbnail-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 0.8em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumbnail-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-item .remove-btn:hover {
    background: #dc3545;
}

/* 裁剪容器样式 */
.crop-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.crop-settings {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.crop-settings h3 {
    margin-bottom: 15px;
    color: #333;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.mode-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.mode-option input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.mode-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #f8f9ff;
}

/* 模式面板 */
.mode-panel {
    margin-top: 20px;
}

.mode-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.crop-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.info-row label {
    font-weight: 600;
    color: #666;
}

.info-row span {
    color: #333;
    font-weight: 500;
}

/* 输入组 */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.input-group input[type="number"],
.input-group input[type="text"],
.input-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.ratio-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ratio-inputs input {
    flex: 1;
}

.ratio-inputs span {
    font-weight: bold;
    color: #666;
}

.preview-selector {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* 裁剪预览 */
.crop-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.crop-preview h3 {
    margin-bottom: 15px;
    color: #333;
}

.canvas-container {
    position: relative;
    display: inline-block;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#previewCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* 裁剪框 */
.crop-box {
    position: absolute;
    border: 2px solid #667eea;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
}

.handle-tl { top: -6px; left: -6px; cursor: nw-resize; }
.handle-tr { top: -6px; right: -6px; cursor: ne-resize; }
.handle-bl { bottom: -6px; left: -6px; cursor: sw-resize; }
.handle-br { bottom: -6px; right: -6px; cursor: se-resize; }
.handle-t { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.handle-r { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }
.handle-b { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.handle-l { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }

/* 命名规则样式 */
.naming-container {
    max-width: 600px;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    line-height: 1.5;
}

.naming-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.naming-preview h4 {
    margin-bottom: 10px;
    color: #333;
}

#namingPreviewList {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.naming-preview-item {
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #667eea;
}

/* 处理容器样式 */
.process-container {
    text-align: center;
}

.progress-container {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

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

.progress-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.progress-detail {
    color: #666;
    font-size: 0.95em;
}

/* 下载容器样式 */
.download-container {
    text-align: center;
}

.result-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
}

.result-info p {
    font-size: 1.1em;
    color: #155724;
}

#successCount {
    font-weight: bold;
    color: #28a745;
}

#failCount {
    font-weight: bold;
    color: #dc3545;
}

.download-container .btn {
    margin: 10px;
}

.result-preview {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.result-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.result-item .result-name {
    padding: 8px;
    background: #f8f9fa;
    text-align: center;
    font-size: 0.85em;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .step-section {
        padding: 20px;
    }

    .crop-container {
        grid-template-columns: 1fr;
    }

    .thumbnail-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .result-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* 图片预览模态框 */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.preview-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 2em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 2em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.preview-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-prev {
    left: -70px;
}

.preview-next {
    right: -70px;
}

.preview-info {
    margin-top: 20px;
    color: white;
    text-align: center;
}

.preview-info span {
    display: block;
    margin: 5px 0;
}

#previewFileName {
    font-size: 1.1em;
    font-weight: 600;
}

#previewCounter {
    font-size: 0.9em;
    opacity: 0.8;
}

.result-item {
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

