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

/* Theme styles have been moved to themes.css */

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* 防止横向滚动 */
    width: 100%; /* 确保宽度为100% */
    max-width: 100vw; /* 最大宽度为视口宽度 */
}

/* 顶部区域样式 */
.top-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    width: 100%; /* 确保宽度为100% */
}

.header-content {
    width: 100%; /* 修改为100%宽度 */
    max-width: none; /* 移除最大宽度限制 */
    margin: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

/* 广告横幅样式 */
.ad-banner {
    flex: 1;
    width: 100%; /* 设置为100%宽度 */
    height: 80px;
    margin: 0; /* 移除右边距 */
    overflow: hidden;
    position: relative; /* 添加相对定位 */
}

.ad-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute; /* 绝对定位以便轮播 */
    left: 0;
    top: 0;
    opacity: 0; /* 默认隐藏所有图片 */
    transition: opacity 0.5s ease; /* 添加淡入淡出效果 */
}

.ad-banner img.active {
    opacity: 1; /* 当前显示的图片 */
    z-index: 1; /* 确保在最上层 */
}

/* 主题切换器样式调整 */
.theme-switcher {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101; /* 确保在广告横幅上方 */
    background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */
    padding: 8px;
    border-radius: 4px;
}

/* Theme switcher styles have been moved to themes.css */

/* 主要内容区域布局 */
.content-section {
    margin-top: 120px; /* 与顶部区域高度相同 */
    min-height: calc(100vh - 240px); /* 减去顶部和底部的高度 */
    display: flex;
    position: relative; /* 为拖动调节器提供定位上下文 */
}

/* 左侧工具栏 */
.tools-sidebar {
    width: 30%;
    min-width: 300px; /* 增加最小宽度 */
    max-width: 50%;
    background-color: var(--sidebar-bg);
    padding: 30px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: width 0.1s ease;
}

/* 拖动调节器 */
.resizer {
    position: absolute;
    left: 30%;
    top: 0;
    bottom: 0;
    width: 6px; /* 减小宽度 */
    background-color: var(--border-color);
    cursor: col-resize;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5; /* 默认z-index较低 */
}

/* 拖动调节器手柄 */
.resizer::after {
    content: "⋮"; /* 添加拖动图标 */
    font-size: 20px;
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.resizer:hover::after {
    opacity: 1;
}

.resizer:hover,
.resizer.resizing {
    background-color: var(--text-color);
    width: 8px; /* 悬停时增加宽度 */
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* 工具栏样式优化 */
.tools {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tools h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* 一级选项样式 */
.crop-option {
    padding: 10px 15px;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.crop-option:hover {
    background-color: var(--hover-color);
}

/* 二级选项容器 */
.sub-options {
    display: none;
    margin: 10px 0;
    padding: 15px;
    background: var(--sidebar-bg);
    border-radius: 8px;
    border-left: 3px solid var(--text-color);
}

.sub-options.active {
    display: block;
}

/* 二级选项样式 */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.option-item:hover {
    border-color: var(--text-color);
}

/* 单选框和标签样式 */
.option-item input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.option-item > label {
    margin: 0 15px;
    font-size: 0.95em;
    white-space: nowrap;
    min-width: 140px;
}

/* 输入区域样式 */
.sub-input {
    flex: 1;
    display: flex;
    align-items: center;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s;
}

.option-item > input[type="radio"]:checked ~ .sub-input {
    opacity: 1;
    pointer-events: auto;
}

/* 输入组样式优化 */
.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.input-group label {
    color: var(--text-color);
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 0; /* 移除最小宽度限制 */
}

/* 输入框样式优化 */
.input-group input[type="number"] {
    width: 120px; /* 统一设置输入框宽度 */
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95em;
    background: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

/* 输入框焦点状态 */
.input-group input[type="number"]:focus {
    border-color: var(--text-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--text-color-rgb), 0.1);
}

/* 输入框禁用状态 */
.input-group input[type="number"]:disabled {
    background-color: var(--sidebar-bg);
    opacity: 0.5;
}

/* 移除输入框的上下箭头 */
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group input[type="number"] {
    -moz-appearance: textfield;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .input-group input[type="number"] {
        width: 100%; /* 在小屏幕上占满宽度 */
    }
}

/* 图片比例选项样式优化 */
.ratio-group {
    width: 100%;
    margin-top: 10px; /* 添加顶部间距，与标签分开 */
}

.ratio-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.ratio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s;
}

.ratio-option:hover {
    border-color: var(--text-color);
    background: var(--hover-color);
}

.ratio-option input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.ratio-option label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
}

.ratio-option label span {
    font-size: 0.9em;
    color: var(--text-color);
}

/* 预览框样式 */
.ratio-preview {
    position: relative;
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s;
}

/* 选中状态样式 */
.ratio-option input[type="radio"]:checked ~ label {
    font-weight: 500;
}

.ratio-option input[type="radio"]:checked ~ label .ratio-preview {
    border-color: var(--text-color);
}

.ratio-option input[type="radio"]:checked ~ label .ratio-preview::before {
    background: var(--text-color) !important;
}

.ratio-option:has(input[type="radio"]:checked) {
    border-color: var(--text-color);
    background: var(--hover-color);
}

/* 禁用状态样式 */
.ratio-option.disabled,
.ratio-option input[type="radio"]:disabled ~ label {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 悬停效果 */
.ratio-option:hover:not(.disabled) .ratio-preview {
    border-color: var(--text-color);
}

.ratio-option:hover:not(.disabled) .ratio-preview::before {
    background: var(--text-color) !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .option-item {
        flex-wrap: wrap;
        padding: 6px 8px; /* 减小内边距 */
    }

    .option-item > label {
        min-width: auto;
        margin-right: auto;
        margin-left: 8px; /* 减少左边距 */
        font-size: 0.9em; /* 略微减小字体 */
    }

    .sub-input {
        width: 100%;
        margin-top: 6px; /* 减小上边距 */
        margin-left: 24px; /* 减小左边距 */
    }
    
    /* 调整输入组样式 */
    .input-group {
        gap: 6px; /* 减小间隔 */
    }
    
    .input-group label {
        font-size: 0.85em; /* 减小字体 */
    }
    
    .input-group input[type="number"] {
        width: 70px; /* 减小输入框宽度 */
        padding: 4px 6px; /* 减小内边距 */
    }
    
    /* 调整子选项容器内边距 */
    .sub-options {
        padding: 10px; /* 减小内边距 */
    }
    
    /* 比例选项优化 */
    .ratio-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px; /* 减小间距 */
    }
    
    .ratio-option {
        padding: 6px 8px; /* 减小内边距 */
    }
    
    .ratio-option label {
        gap: 6px; /* 减小间距 */
    }
    
    .ratio-option label span {
        font-size: 0.85em; /* 减小字体 */
    }
    
    .ratio-preview {
        width: 28px; /* 减小预览框尺寸 */
        height: 28px;
    }
}

/* 平板设备针对性优化 */
@media (min-width: 481px) and (max-width: 768px) {
    .content-section {
        flex-direction: column;
        margin-top: 120px; /* 匹配顶部区域高度 */
    }
    
    .theme-switcher {
        right: 15px;
    }
    
    .tools-sidebar {
        min-width: 100%;
        width: 100% !important;
        max-height: none;
        overflow-y: visible;
        padding: 20px 15px; /* 恢复侧边栏内边距 */
    }
    
    #resizer {
        display: none;
    }
    
    .content-area {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 15px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ratio-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tools {
        padding: 15px; /* 恢复工具容器内边距 */
    }
    
    /* 恢复平板设备的输入框样式 */
    .option-item > label {
        min-width: 100px; /* 为平板设置一个较小但固定的标签宽度 */
        margin: 0 10px 0 8px; /* 减少左右边距 */
    }
    
    .sub-input {
        margin-left: 0; /* 移除左边距 */
        width: auto; /* 让宽度自适应 */
    }
    
    .input-group input[type="number"] {
        width: 80px; /* 平板上稍微大一点的输入框 */
    }
}

/* 手机设备额外优化 */
@media (max-width: 480px) {
    .option-item > label {
        font-size: 0.85em; /* 进一步减小字体 */
    }
    
    .tools-sidebar {
        padding: 15px 10px; /* 更小的侧边栏内边距 */
    }
    
    .option-item {
        padding: 5px 8px; /* 更小的内边距 */
    }
    
    .sub-input {
        margin-left: 20px; /* 更小的左边距 */
    }
    
    /* 输入组进一步调整 */
    .input-group {
        gap: 4px; /* 更小的间隔 */
    }
    
    .input-group label {
        font-size: 0.8em; /* 更小的字体 */
    }
    
    .input-group input[type="number"] {
        width: 60px; /* 更小的输入框 */
        padding: 3px 5px; /* 更小的内边距 */
    }
    
    /* 比例选项优化 */
    .ratio-options {
        grid-template-columns: repeat(2, 1fr); /* 保持2列布局 */
    }
    
    .ratio-option {
        padding: 4px 6px; /* 更小的内边距 */
    }
    
    .ratio-preview {
        width: 24px; /* 更小的预览框 */
        height: 24px;
    }
    
    .ratio-option label span {
        font-size: 0.8em; /* 更小的字体 */
    }
    
    /* 模态框优化 */
    .modal-header {
        padding: 10px; /* 减小模态框头部内边距 */
    }
    
    .modal-header h3 {
        font-size: 1em; /* 减小标题字体 */
    }
    
    .modal-body {
        padding: 10px; /* 减小模态框内容内边距 */
    }
    
    .close-btn {
        width: 25px; /* 减小关闭按钮尺寸 */
        height: 25px;
        font-size: 16px;
    }
    
    .nav-btn {
        width: 30px; /* 减小导航按钮尺寸 */
        height: 30px;
        font-size: 16px;
    }
    
    /* 按钮组紧凑化 */
    .button-group {
        gap: 6px;
        margin-top: 10px;
    }
    
    .button-group input[type="button"] {
        padding: 6px 10px;
        font-size: 0.9em;
        height: 32px;
    }
    
    /* 图片操作按钮调整 */
    .image-actions {
        padding: 6px;
    }
    
    .image-actions button {
        padding: 4px 8px;
        font-size: 0.8em;
    }
}

/* 触摸屏设备的交互优化进一步加强 */
@media (pointer: coarse) and (max-width: 768px) {
    /* 确保所有可点击元素有足够尺寸 */
    .option-item input[type="radio"],
    .ratio-option input[type="radio"] {
        min-width: 18px;
        min-height: 18px;
    }
    
    /* 增加表单元素之间的距离，防止误触 */
    .option-item {
        margin-bottom: 6px;
    }
}

/* 底部样式 */
footer {
    background-color: var(--sidebar-bg);
    padding: 20px;
    height: 120px; /* 固定底部高度 */
}

.friend-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.friend-links h4 {
    margin: 0;
}

.friend-links ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

.friend-links a {
    color: var(--text-color);
    text-decoration: none;
}

.friend-links a:hover {
    text-decoration: underline;
}

.copyright {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .header-content {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .top-section {
        height: auto;
        position: static;
    }

    .header-content {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    .content-section {
        flex-direction: column;
        min-height: auto;
    }

    .tools-sidebar {
        width: 100% !important; /* 强制全宽 */
        max-width: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .resizer {
        display: none; /* 在移动端隐藏拖动调节器 */
    }

    .content-area,
    footer {
        margin-left: 0;
    }

    .option-item {
        flex-wrap: wrap;
    }

    .sub-input {
        width: 100%;
        margin-left: 30px;
    }
}

@media (max-width: 480px) {
    .image-gallery {
        grid-template-columns: 1fr;
    }

    .ratio-options {
        grid-template-columns: 1fr;
    }
}

/* 更新上传区域悬停效果 */
.upload-area:hover {
    background-color: var(--hover-color);
    border-color: var(--text-color);
}

/* 单选框和标签样式 */
input[type="radio"] {
    cursor: pointer;
}

label {
    cursor: pointer;
    user-select: none;
}

/* 输入框样式 */
input[type="number"] {
    width: 100%;
}

/* 悬停效果 */
.ratio-option:hover .ratio-preview {
    background-color: var(--text-color);
}

.input-group input:focus {
    outline: none;
    border-color: var(--text-color);
    box-shadow: 0 0 0 2px var(--border-color);
}

/* 裁剪按钮样式 */
.crop-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin-top: 20px;
    background-color: var(--text-color);
    color: var(--bg-color);
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.crop-button:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.crop-button:active:not(:disabled) {
    transform: translateY(0);
}

.crop-button:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.crop-button.active {
    background-color: var(--text-color);
    opacity: 1;
}

/* 禁用状态的单选框样式 */
input[type="radio"]:disabled + label {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 图片上传区域样式 */
.upload-area {
    width: 100%;
    height: 300px; /* 固定上传区域高度 */
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--text-color);
    opacity: 0.6;
}

.upload-box p {
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
}

/* 拖拽状态样式 */
.upload-area.drag-over {
    border-color: var(--text-color);
    background-color: rgba(var(--text-color-rgb), 0.05);
}

/* 图片展示区样式 */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: var(--bg-color);
    transition: all 0.3s ease;
}

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

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

.image-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .image-actions {
    opacity: 1;
}

/* 图片操作按钮样式 */
.image-actions button {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-actions button:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.delete-btn {
    background: #ff4444 !important;
    color: white !important;
}

.delete-btn:hover {
    background: #cc0000 !important;
}

/* 上传预览区域样式 */
.upload-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
}

.upload-preview img {
    max-width: 100%;
    max-height: 260px; /* 控制图片最大高度 */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* 预览层样式 */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

/* 针对上传区域的预览层特殊样式 */
.upload-preview .preview-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 260px;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* 创建一个容器来限制预览线的范围 */
.preview-lines-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.preview-line {
    position: absolute;
    background: none;
    transition: all 0.3s ease;
}

.preview-line.horizontal {
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.preview-line.vertical {
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.3);
}

/* 预览操作按钮容器 */
.preview-actions {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 2; /* 确保在预览线之上 */
}

.preview-actions button {
    flex: 1;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.preview-actions button:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

/* 预览弹窗样式优化 */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
    overflow: auto;
}

.modal-body img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--text-color);
    color: var(--bg-color);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    transform: scale(1.1);
    background: var(--hover-color);
}

/* 添加动画效果 */
.preview-modal .modal-content {
    animation: modalShow 0.3s ease;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 预览弹窗导航按钮样式 */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.nav-btn:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

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

/* 优化预览图片容器 */
.modal-body {
    position: relative;
    padding: 20px 60px;
}

/* 让图片可以点击预览 */
.image-item img {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-item img:hover {
    transform: scale(1.02);
}

/* 确保二级选项显示时的样式 */
.sub-options.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* 验证消息样式 */
.validation-message {
    font-size: 0.85em;
    color: #ff4444;
    margin-top: 5px;
    display: none; /* 默认隐藏 */
    line-height: 1.2;
}

.validation-message.error {
    display: block; /* 有错误时显示 */
    color: #ff4444;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.button-group input[type="button"] {
    flex: 0 0 calc(50% - 5px); /* 每行两个按钮，考虑间隔 */
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background: var(--text-color);
    color: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em; /* 统一字体大小 */
    height: 36px; /* 统一按钮高度 */
    line-height: 20px; /* 确保文字垂直居中 */
    margin-bottom: 10px; /* 添加下边距 */
}

.button-group input[type="button"]:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.button-group input[type="button"]:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

/* 删除全部按钮样式 */
#deleteAllBtn {
    background: #ff4444;
}

#deleteAllBtn:disabled {
    background: #ffaaaa;
}

/* 下载全部按钮样式 */
#downloadAllBtn {
    background: #4CAF50;
}

#downloadAllBtn:disabled {
    background: #a5d6a7;
}

/* 预览容器样式 */
.preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    object-fit: contain;
}

/* 预览层样式 */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.preview-line {
    position: absolute;
    background: none;
    transition: all 0.3s ease;
}

.preview-line.horizontal {
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.preview-line.vertical {
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.3);
}

/* 修改预览弹窗样式 */
.preview-modal .modal-body {
    position: relative;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.preview-modal .preview-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

/* 确保上传预览区域的样式正确 */
.upload-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
}

.upload-preview img {
    max-width: 100%;
    max-height: 260px; /* 控制图片最大高度 */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* 预览层样式 */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

/* 针对上传区域的预览层特殊样式 */
.upload-preview .preview-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 260px;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* 创建一个容器来限制预览线的范围 */
.preview-lines-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.preview-line {
    position: absolute;
    background: none;
    transition: all 0.3s ease;
}

.preview-line.horizontal {
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.preview-line.vertical {
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.3);
}

/* 预览操作按钮容器 */
.preview-actions {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 2; /* 确保在预览线之上 */
}

.preview-actions button {
    flex: 1;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.preview-actions button:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

/* 增强的响应式设计 */
/* 小型手机 */
@media (max-width: 320px) {
    .header-content {
        padding: 0;
    }
    
    .theme-switcher {
        right: 10px;
        padding: 5px;
    }
    
    .theme-switcher select {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    .top-section {
        height: 100px; /* 减小顶部区域高度 */
    }
    
    .ad-banner {
        height: 70px; /* 减小广告横幅高度 */
    }
    
    .tools-sidebar {
        min-width: 100%;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ratio-options {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        width: 100%;
    }
    
    .sub-input {
        width: 100%;
        margin-left: 15px;
    }
    
    .slide-preview-panel {
        width: 100% !important;
    }
    
    .preview-image {
        max-width: 100%;
    }
}

/* 标准手机 */
@media (max-width: 480px) {
    .header-content {
        padding: 0;
    }
    
    .theme-switcher {
        right: 10px;
    }
    
    .top-section {
        height: 100px; /* 减小顶部区域高度 */
    }
    
    .ad-banner {
        height: 70px; /* 减小广告横幅高度 */
    }
    
    .tools-sidebar {
        min-width: 100%;
        width: 100% !important;
        overflow-y: auto;
        max-height: 70vh;
        margin-top: 100px; /* 匹配顶部区域高度 */
    }
    
    .content-section {
        margin-top: 100px; /* 匹配顶部区域高度 */
    }
    
    #resizer {
        display: none;
    }
    
    .tools {
        padding: 15px 10px;
    }
    
    .content-area {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 15px 10px;
    }
    
    .option-item {
        margin-bottom: 15px;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .upload-box {
        height: 150px;
    }
    
    /* 显示/隐藏工具栏的按钮 */
    .toggle-sidebar-btn {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: var(--text-color);
        color: var(--bg-color);
        border: none;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        font-weight: bold;
        cursor: pointer;
    }
}

/* 平板设备 */
@media (min-width: 481px) and (max-width: 768px) {
    .content-section {
        flex-direction: column;
        margin-top: 120px; /* 匹配顶部区域高度 */
    }
    
    .theme-switcher {
        right: 15px;
    }
    
    .tools-sidebar {
        min-width: 100%;
        width: 100% !important;
        max-height: none;
        overflow-y: visible;
        padding: 20px 15px; /* 恢复侧边栏内边距 */
    }
    
    #resizer {
        display: none;
    }
    
    .content-area {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 15px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ratio-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tools {
        padding: 15px; /* 恢复工具容器内边距 */
    }
    
    /* 恢复平板设备的输入框样式 */
    .option-item > label {
        min-width: 100px; /* 为平板设置一个较小但固定的标签宽度 */
        margin: 0 10px 0 8px; /* 减少左右边距 */
    }
    
    .sub-input {
        margin-left: 0; /* 移除左边距 */
        width: auto; /* 让宽度自适应 */
    }
    
    .input-group input[type="number"] {
        width: 80px; /* 平板上稍微大一点的输入框 */
    }
}

/* 大型平板/小型笔记本 */
@media (min-width: 769px) and (max-width: 1024px) {
    .theme-switcher {
        right: 20px;
    }
    
    .tools-sidebar {
        min-width: 320px;
        width: 30% !important;
        position: relative; /* 添加相对定位 */
        z-index: 20; /* 确保工具栏在调节器上面 */
    }
    
    .resizer {
        width: 8px; /* 调整宽度使其更容易点击 */
        background-color: rgba(0, 0, 0, 0.1); /* 半透明背景 */
        opacity: 0.7; /* 降低整体不透明度 */
    }
    
    .resizer:hover,
    .resizer.resizing {
        background-color: var(--text-color);
        opacity: 0.5;
    }
    
    .content-area {
        width: 70% !important;
        padding: 20px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 桌面设备 */
@media (min-width: 1025px) {
    .theme-switcher {
        right: 30px;
    }
}

/* 触摸屏设备的交互优化 */
@media (pointer: coarse) {
    /* 增大按钮尺寸以便于触摸 */
    .button-group input[type="button"],
    .preview-btn, .download-btn, .delete-btn {
        min-height: 44px;
        padding: 10px 15px;
    }
    
    /* 增大输入控件的可点击区域 */
    .input-group {
        min-height: 40px;
    }
    
    .input-group input[type="number"] {
        font-size: 16px; /* 防止iOS上的缩放 */
    }
    
    .number-button {
        height: 20px;
    }
    
    /* 增大单选框和标签的点击区域 */
    input[type="radio"] + label {
        padding: 8px 0;
    }
    
    .ratio-option {
        padding: 10px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .tools-sidebar {
        width: 40% !important;
        max-height: 85vh;
        overflow-y: auto;
        position: relative;
        z-index: 20;
    }
    
    .content-area {
        width: 60% !important;
    }
    
    .resizer {
        width: 8px;
        background-color: rgba(0, 0, 0, 0.1);
        opacity: 0.7;
        z-index: 10;
    }
    
    .resizer:hover,
    .resizer.resizing {
        background-color: var(--text-color);
        opacity: 0.5;
    }
    
    .image-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}
