/* ============ 九宫格切图 - 工具特有样式 ============ */
/* 通用样式（卡片、按钮、分隔线、info-box、empty-state等）已由 common.css 统一提供 */

/* ---- 容器 ---- */
#jg-container {
    margin-bottom: 15px;
}

/* ---- 左右两栏 flex 布局 ---- */
#jg-container > .section-row {
    display: flex;
    gap: 15px;
    margin-bottom: 0;
}

#jg-container > .section-row > .settings-card {
    flex: 1;
    margin-top: 0;
    margin-bottom: 0;
}

#jg-container > .section-row > .preview-card {
    flex: 2;
    margin-top: 0;
    margin-bottom: 0;
}

/* ---- 上传区 ---- */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 40px;
    border: 3px dashed #d1d5db;
    border-radius: 16px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.upload-icon {
    font-size: 48px;
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.upload-hint {
    font-size: 13px;
    color: #9ca3af;
}

/* ---- 设置分组 ---- */
.setting-group {
    margin-bottom: 16px;
}

.setting-group-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
}

/* ---- 行列步进控件 ---- */
.control-group {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 14px;
}

.control-label {
    font-size: 14px;
    color: #374151;
    margin-right: 8px;
    flex-shrink: 0;
}

.step-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.step-btn:first-of-type {
    border-radius: 4px 0 0 4px;
}

.step-btn:last-of-type {
    border-radius: 0 4px 4px 0;
}

.step-btn:hover {
    background: #e5e7eb;
}

.step-input {
    width: 50px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 14px;
    color: #374151;
    outline: none;
}

/* ---- 旋转按钮 ---- */
.rotation-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-rotate {
    flex: 1;
    padding: 9px 0;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-rotate:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
    color: #7c3aed;
}

/* ---- 卡片头部中间统计 ---- */
.card-header-center {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

.card-header-center strong {
    color: #8b5cf6;
    font-weight: 600;
}

/* ---- 预览区（透明棋盘格背景） ---- */
.preview-section {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: repeating-conic-gradient(#ccc 0% 25%, transparent 0% 50%) 50% / 20px 20px;
    border-radius: 8px;
    min-height: 300px;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.preview-canvas {
    display: block;
    max-width: 100%;
    max-height: 500px;
}

/* ---- 切图结果（整块，位于说明上方） ---- */
.result-section {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
}

.slices-grid {
    display: grid;
    gap: 8px;
}

.slice-item {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.slice-item:hover {
    border-color: #8b5cf6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.slice-image {
    width: 100%;
    height: auto;
    display: block;
}

.slice-size {
    position: absolute;
    top: 0;
    left: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    text-align: center;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border-bottom-right-radius: 6px;
}

.slice-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    text-align: center;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ---- 功能说明信息区 ---- */
#app > .info-section {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    #jg-container > .section-row {
        flex-direction: column;
        gap: 12px;
    }

    #app > .info-section {
        grid-template-columns: 1fr;
    }
}
