/* ... (body, h1, h2, .container 样式无修改) ... */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1, h2 {
    margin: 0;
    color: #1a535c;
}

.container {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}


/* 1. 上传区域 */
/* *** 新增：拖拽悬停样式 *** */
#uploadBox {
    /* 添加过渡效果 */
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border: 2px dashed #ddd; /* 默认给一个虚线框 */
    padding: 20px; /* 确保 container 的 padding 不会被覆盖 */
}
#uploadBox label {
    display: block;
    background-color: #4ecdc4;
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
#uploadBox label:hover {
    background-color: #3aa39b;
}
#fileInput {
    display: none;
}
/* *** 新增：拖拽悬停状态 *** */
#uploadBox.drag-over {
    background-color: #e0f7f6; /* 浅绿色背景 */
    border-color: #4ecdc4; /* 匹配主题色 */
    border-style: solid; /* 变为实线 */
}


/* 2. 图片列表 (无修改) */
#imageList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    min-height: 100px;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 5px;
}
.image-card {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: move; /* 提示可拖拽 */
}
.image-card .img-preview {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background-color: #eee;
    display: block;
}
.image-card .tools {
    display: flex;
    justify-content: center; /* 修改：居中 */
    gap: 20px; /* 修改：添加间距 */
    padding: 8px;
    background-color: #fff;
    border-top: 1px solid #eee;
}
.image-card .tools button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    color: #555;
    transition: color 0.2s;
}
.image-card .tools button:hover {
    color: #1a535c;
}
/* *** 新增：特定按钮的 hover 颜色 *** */
.image-card .tools .rotate-btn:hover {
    color: #fca311; /* 旋转按钮 - 橙色 */
}
.image-card .tools .crop-btn:hover {
    color: #4ecdc4; /* 裁剪按钮 - 绿色 */
}

.image-card .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 22px;
    text-align: center;
}
.image-card .delete-btn:hover {
    background: #ff4b4b;
}

/* 3. 扫描件设置 (无修改) */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: center;
}
.slider-group {
    display: flex;
    flex-direction: column;
}
.slider-group label {
    margin-bottom: 5px;
    font-weight: 500;
}
.slider-group input[type="range"] {
    width: 100%;
}
.slider-group span {
    font-size: 13px;
    color: #666;
    text-align: right;
}

/* 4. 导出设置 (无修改) */
.export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.checkbox-group {
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 5px;
}
.checkbox-group h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #1a535c;
}
.checkbox-group div {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.checkbox-group input {
    width: 16px;
    height: 16px;
}

.filename-group {
    margin-bottom: 20px; /* 在输入框和按钮间增加间距 */
}
.filename-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.filename-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box; /* 确保 padding 不会撑破 100% 宽度 */
    font-size: 16px;
}
.filename-group input[type="text"]::placeholder {
    color: #aaa;
    font-style: italic;
    font-size: 14px;
}
/* 5. 生成按钮 (无修改) */
#generateButton {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background-color: #1a535c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;
}
#generateButton:hover {
    background-color: #144249;
}
#generateButton:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}
#generateButton .spinner {
    display: none;
    position: absolute;
    right: 20px;
    top: 50%;
    margin-top: -9px;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}
#generateButton.loading .spinner {
    display: block;
}
#generateButton.loading span {
    margin-right: 30px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 裁剪模态框 (无修改) */
#cropModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}
#cropModal.show {
    display: flex;
}
.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
#cropImageContainer {
    max-width: 80vw;
    max-height: 70vh;
    overflow: hidden;
}
#cropImageContainer img {
    max-width: 100%;
    max-height: 100%;
}
.modal-tools {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}
.modal-tools button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}
#applyCrop {
    background-color: #4ecdc4;
    color: white;
}
#cancelCrop {
    background-color: #ddd;
    color: #333;
}

/* Tooltip (无修改) */
.slider-group label[data-tooltip] { 
    position: relative;
    cursor: help; 
    border-bottom: 1px dashed #777;
    display: inline-block; 
    width: fit-content; 
}
.slider-group label[data-tooltip]::after {
    content: attr(data-tooltip); 
    position: absolute;
    left: 100%;
    bottom: 100%; 
    transform: translateX(-50%);
    margin-bottom: 8px; 
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500; 
    line-height: 1.4;
    white-space: normal; 
    width: 250px; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10; 
    pointer-events: none; 
}
.slider-group label[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 3px; 
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    pointer-events: none;
}
.slider-group label[data-tooltip]:hover::after,
.slider-group label[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 重置按钮 (无修改) */
.container .danger-btn {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    height: fit-content;
}
.container .danger-btn:hover {
    background-color: #e05252;
}
.settings-description {
    font-size: 13px;
    color: #666;
    margin: 10px 0 0 0; 
}

/* *** 新增：加载中遮罩层样式 *** */
#loadingOverlay {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000; /* 最高层级 */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    font-size: 18px;
}
#loadingOverlay .spinner {
    /* 借用 #generateButton 的 spinner 样式，但尺寸更大 */
    display: block;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
#loadingOverlay p {
    margin: 0;
}
