/* =========================================
   Pintu.css - 拼图工具专用样式 (优化版)
   ========================================= */

/* 注意：已移除 :root 和 body 的全局定义，
   直接继承 common.css 的变量，避免样式冲突。
   如果需要特定变量，建议使用局部作用域。
*/

/* --- 主容器布局 --- */
.container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    justify-content: center;
    align-items: flex-start;
    /* 防止侧边栏被拉伸到和预览区一样高 */
}

/* --- 左侧控制栏 --- */
.sidebar {
    flex: 1;
    min-width: 350px;
    /* 增大最小宽度 */
    max-width: 480px;
    /* 增大最大宽度 */
    background: var(--card-light, #ffffff);
    /* 尝试使用全局变量，如果没有则回退到白色 */
    padding: 25px;
    border-radius: 16px;
    /* 更圆润的边角 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* 更柔和的阴影 */
    height: fit-content;
    position: relative;
    z-index: 10;
}

/* --- 右侧预览区 --- */
.preview-area {
    flex: 2;
    min-width: 320px;
    min-height: 600px;
    /* 预览区保持灰色背景，以便看清图片边缘 */
    background-color: #e0e0e0;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 内容居中 */
    padding: 30px;
    overflow: auto;
    /* 超出滚动 */
    border: 4px solid #fff;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    /* 内部阴影增加层次感 */

    /* 棋盘格透明背景优化 */
    background-image:
        linear-gradient(45deg, #dcdcdc 25%, transparent 25%),
        linear-gradient(-45deg, #dcdcdc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #dcdcdc 75%),
        linear-gradient(-45deg, transparent 75%, #dcdcdc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-area img {
    max-width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    /* 图片悬浮感 */
    display: none;
    /* 默认隐藏，JS控制显示 */
    transition: transform 0.3s ease;
}

/* --- 控件通用样式 --- */
h2 {
    margin-top: 0;
    color: var(--text-light, #2c3e50);
    font-size: 18px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-weight: 700;
}

.control-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light, #555);
}

select,
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--primary-color, #4A6CF7);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

/* --- 滑动条美化 (Input Range) --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    margin: 10px 0;
    background: transparent;
    padding: 0;
    /* 重置 padding */
}

input[type="range"]:focus {
    outline: none;
}

/* 滑动轨道 */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #e0e0e0;
    border-radius: 3px;
    transition: background 0.2s;
}

/* 滑块按钮 */
input[type="range"]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--primary-color, #4A6CF7);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    /* (6 - 18) / 2 */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* --- 提示框 --- */
.hint {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    line-height: 1.5;
    background: rgba(74, 108, 247, 0.05);
    /* 极淡的蓝色背景 */
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color, #4A6CF7);
}

/* --- 按钮样式 --- */
.btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color, #4A6CF7);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(74, 108, 247, 0.2);
}

.btn:hover {
    background: var(--primary-dark, #3a56d4);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 108, 247, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* 上传按钮特殊样式 */
.btn-upload {
    background: #fff;
    color: var(--primary-color, #4A6CF7);
    border: 2px dashed rgba(74, 108, 247, 0.3);
    box-shadow: none;
}

.btn-upload:hover {
    background: rgba(74, 108, 247, 0.05);
    border-color: var(--primary-color, #4A6CF7);
    color: var(--primary-color, #4A6CF7);
}

/* --- 图片列表 --- */
.img-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

/* 自定义滚动条 */
.img-list::-webkit-scrollbar,
.preview-area::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.img-list::-webkit-scrollbar-thumb,
.preview-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.img-list::-webkit-scrollbar-track,
.preview-area::-webkit-scrollbar-track {
    background: transparent;
}

.img-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: background 0.2s;
}

.img-item:hover {
    background: #f5f7ff;
}

.img-item:last-child {
    border-bottom: none;
}

.img-item img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 12px;
    border: 1px solid #eee;
}

.img-item span {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #444;
}

.img-item .del {
    color: #ff6b6b;
    cursor: pointer;
    padding: 6px;
    font-size: 14px;
    transition: transform 0.2s;
    opacity: 0.7;
}

.img-item .del:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- 隐藏 Canvas --- */
#canvas {
    display: none;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 20px;
    }

    .sidebar {
        width: 100%;
        min-width: unset;
        /* 取消最小宽度限制 */
        max-width: 100%;
        box-sizing: border-box;
        /* 确保 padding 包含在宽度内 */
        order: 2;
        /* 手机上控制台放下面 (可选，根据需求调整) */
    }

    .preview-area {
        width: 100%;
        min-width: unset;
        min-height: 400px;
        /* 手机上减小高度 */
        padding: 15px;
        order: 1;
    }

    .main-title {
        font-size: 1.5rem;
        /* 缩小标题 */
        margin: 15px 0;
    }

    /* 优化 SEO 文本区域在手机上的显示 */
    .seo-intro {
        margin: 20px 10px;
        padding: 15px;
    }
}

/* 拖拽上传样式 */
.sidebar.drag-over {
    border: 2px dashed var(--primary-color, #4A6CF7);
    background: rgba(74, 108, 247, 0.05);
}

.img-item {
    cursor: move;
    /* 指示可拖拽 */
}

.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}

/* --- SEO Optimization Styles --- */
.seo-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    color: #4a4a4a;
    line-height: 1.8;
}

.seo-intro {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.seo-intro h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color, #4A6CF7);
    display: inline-block;
    padding-bottom: 5px;
    color: var(--text-light, #2c3e50);
}

.seo-intro p {
    margin-bottom: 15px;
    font-size: 15px;
}

.seo-details {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.detail-column {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.detail-column h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: none;
    padding-bottom: 0;
}

.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    margin-bottom: 12px;
    padding-left: 5px;
}

.faq-answer {
    margin-bottom: 15px;
    font-size: 14px;
    color: #555;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
}

body.dark-mode .seo-intro,
body.dark-mode .detail-column {
    background: var(--card-dark, #1e2538);
    color: var(--text-dark, #e2e8f0);
}

body.dark-mode .seo-intro h2,
body.dark-mode .detail-column h3 {
    color: var(--text-dark, #f8f9fa);
}

body.dark-mode .seo-content {
    color: var(--text-secondary-dark, #a0a0a0);
}

body.dark-mode .faq-answer {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary-dark, #ccc);
}