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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header-div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 auto 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
}

.header-title {
    margin: 0 0 10px 0;
    font-size: 2rem;
    font-weight: 700;
}

.header-link {
    margin-top: 10px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.link-a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

.link-a:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

/* 通用卡片样式 */
.section-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

/* 上传区域 */
.upload-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.upload-area {
    padding: 40px 20px;
    text-align: center;
    position: relative;
}

.file-label {
    display: block;
    cursor: pointer;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.file-label:hover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

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

.upload-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

#fileInput {
    display: none;
}

/* 设置区域 */
.settings-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.settings-container {
    padding: 20px;
}

.settings-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

/* 水印类型 */
.watermark-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 文字输入 */
.text-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    width: 100%;
}

.text-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 字体大小控制 */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#fontSizeSlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#fontSizeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

#fontSizeSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

#fontSizeValue {
    font-weight: 500;
    color: #007bff;
    min-width: 50px;
}

/* 颜色控制 */
.color-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#textColor {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#opacitySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#opacitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

#opacitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

#opacityValue {
    font-weight: 500;
    color: #007bff;
    min-width: 40px;
}

/* 字体选择 */
.font-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

.font-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 图片水印设置 */
.image-upload-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.image-upload-label:hover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.upload-icon-small {
    font-size: 2rem;
    margin-bottom: 5px;
}

#watermarkImageInput {
    display: none;
}

.watermark-preview {
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.watermark-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 大小控制 */
.size-control, .opacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#watermarkSizeSlider, #watermarkOpacitySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#watermarkSizeSlider::-webkit-slider-thumb,
#watermarkOpacitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

#watermarkSizeSlider::-moz-range-thumb,
#watermarkOpacitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

#watermarkSizeValue, #watermarkOpacityValue {
    font-weight: 500;
    color: #007bff;
    min-width: 60px;
}

/* 位置网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.position-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-btn:hover {
    background-color: #f0f8ff;
    border-color: #007bff;
}

.position-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.custom-position {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.position-inputs {
    display: flex;
    gap: 10px;
}

.position-inputs input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

/* 样式选项 */
.style-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rotation-control {
    margin-top: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

#rotationSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin: 10px 0;
}

#rotationSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

#rotationSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

#rotationValue {
    font-weight: 500;
    color: #007bff;
    text-align: center;
    display: block;
}

/* 输出选项 */
.output-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.format-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

.format-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 复选框和单选框样式 */
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.checkbox-label:hover, .radio-label:hover {
    background-color: #f0f8ff;
}

.checkbox-label input[type="checkbox"], .radio-label input[type="radio"] {
    display: none;
}

.checkmark, .radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.radio-mark {
    border-radius: 50%;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #007bff;
    border-color: #007bff;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.radio-label input[type="radio"]:checked + .radio-mark {
    border-color: #007bff;
}

.radio-label input[type="radio"]:checked + .radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: #007bff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

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

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

.btn-outline {
    background-color: transparent;
    color: #007bff;
    border: 2px solid #007bff;
}

.btn-outline:hover {
    background-color: #007bff;
    color: white;
}

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

.btn-success:hover {
    background-color: #218838;
}

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

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

/* 图片列表区域 */
.images-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.images-container {
    padding: 20px;
}

.images-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.image-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.image-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.image-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 8px;
}

.image-info {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.image-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    word-break: break-all;
}

.image-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.image-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* 进度区域 */
.progress-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-container {
    padding: 20px;
}

.progress-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* 结果区域 */
.results-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.results-container {
    padding: 20px;
}

.results-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.result-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa;
    text-align: center;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.result-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
}

.result-info {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.result-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    word-break: break-all;
}

.result-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.result-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* 使用说明区域 */
.instructions-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.instructions-container {
    padding: 20px;
}

.instructions-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.instructions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.instruction-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.instruction-item h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 1rem;
}

.instruction-item p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* 拖拽状态 */
.upload-area.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.upload-area.dragover .file-label {
    border-color: #007bff;
    background-color: #f0f8ff;
}

/* 加载状态 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .main-container {
        padding: 0 5px;
    }
    
    .header-title {
        font-size: 1.5rem;
    }
    
    .header-link {
        flex-direction: column;
        gap: 10px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .images-grid,
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .instructions-content {
        grid-template-columns: 1fr;
    }
    
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .position-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .header-div {
        padding: 15px;
    }
    
    .header-title {
        font-size: 1.3rem;
    }
    
    .upload-area {
        padding: 20px 15px;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .settings-container,
    .images-container,
    .progress-container,
    .results-container,
    .instructions-container {
        padding: 15px;
    }
    
    .images-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .position-inputs {
        flex-direction: column;
    }
}
