/* ============================================================
 * 图片工具箱 image-tools.css
 * 配色全部走 CSS 变量，自动适配黑夜模式
 * ============================================================ */

/* hidden 属性统一强制隐藏（避免被 display:flex 等覆盖） */
[hidden] { display: none !important; }

/* ---------- Hero ---------- */
.it-hero {
    position: relative;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 20px;
    padding: 24px;
    margin: 24px 0 40px;
    overflow: hidden;
}
.it-hero::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, var(--c-primary-soft, #e0e7ff), transparent 70%);
    pointer-events: none;
}
.it-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.it-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: var(--c-primary-soft, #eef2ff);
    border: 1px solid var(--c-border, #e5e7eb);
    flex-shrink: 0;
}
.it-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text, #111827);
    line-height: 1.2;
}
.it-sub {
    font-size: 13px;
    color: var(--c-text-sub, #4b5563);
    margin-top: 4px;
}

/* ---------- 上传态 ---------- */
.it-upload-box {
    position: relative;
    border: 2px dashed var(--c-border, #d1d5db);
    border-radius: 16px;
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--c-bg-soft, #f9fafb);
}
.it-upload-box:hover,
.it-upload-box.dragging {
    border-color: var(--c-primary, #6366f1);
    background: var(--c-primary-soft, #eef2ff);
}
.it-upload-icon {
    font-size: 44px;
    margin-bottom: 12px;
    filter: grayscale(.2);
}
.it-upload-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text, #111827);
    margin: 0 0 6px;
}
.it-upload-sub {
    font-size: 12.5px;
    color: var(--c-text-muted, #6b7280);
    margin: 0 0 18px;
}
.it-upload-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- 双栏布局 ---------- */
.it-layout {
    position: relative;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
}
.it-panel,
.it-stage {
    background: var(--c-surface, #fafafa);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 14px;
    padding: 14px;
}

/* ---------- 控制面板 ---------- */
.it-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 720px;
    overflow-y: auto;
}
.it-panel::-webkit-scrollbar { width: 6px; }
.it-panel::-webkit-scrollbar-thumb { background: var(--c-border, #d1d5db); border-radius: 3px; }

.it-group {
    padding: 12px 2px;
    border-bottom: 1px dashed var(--c-border, #e5e7eb);
}
.it-group:last-child { border-bottom: none; }

.it-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.it-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text, #111827);
}
.it-tip {
    font-size: 11.5px;
    color: var(--c-text-muted, #6b7280);
}
.it-val {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-primary, #6366f1);
    font-variant-numeric: tabular-nums;
}
.it-file-name {
    font-size: 12px;
    color: var(--c-text-muted, #6b7280);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.it-info-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.it-info-chip {
    font-size: 11.5px;
    color: var(--c-text-sub, #4b5563);
    background: var(--c-bg-soft, #f3f4f6);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 999px;
    padding: 3px 10px;
}

/* ---------- 分段控件 ---------- */
.it-seg {
    display: flex;
    background: var(--c-bg-soft, #f3f4f6);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 10px;
}
.it-seg button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--c-text-sub, #4b5563);
    font-size: 12.5px;
    font-weight: 500;
    padding: 6px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all .18s;
}
.it-seg button.active {
    background: var(--c-primary, #6366f1);
    color: #fff;
}

/* ---------- 滑杆 ---------- */
.it-range-row { margin: 10px 0 2px; }
.it-range {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--c-bg-soft, #e5e7eb);
    border-radius: 2px;
    outline: none;
}
.it-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-primary, #6366f1);
    border: 3px solid var(--c-surface, #fff);
    box-shadow: 0 0 0 1px var(--c-border, #d1d5db);
    cursor: pointer;
}
.it-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--c-primary, #6366f1);
    border: 2px solid var(--c-surface, #fff);
    cursor: pointer;
}

/* ---------- 输入 ---------- */
.it-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.it-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--c-text-sub, #4b5563);
    flex: 1;
}
.it-mini .it-input { min-width: 0; }
.it-times { color: var(--c-text-muted, #9ca3af); }
.it-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    background: var(--c-bg-soft, #f3f4f6);
    color: var(--c-text, #111827);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
}
.it-input:focus { border-color: var(--c-primary, #6366f1); }
.it-input-row--4 .it-mini { flex: 1; }

.it-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--c-text-sub, #4b5563);
    cursor: pointer;
    margin-top: 6px;
}
.it-check input { accent-color: var(--c-primary, #6366f1); }

/* ---------- 开关按钮 ---------- */
.it-toggle-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}
.it-toggle {
    flex: 1;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-soft, #f3f4f6);
    color: var(--c-text-sub, #4b5563);
    border-radius: 10px;
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
    transition: all .18s;
}
.it-toggle.active {
    background: var(--c-primary-soft, #eef2ff);
    color: var(--c-primary, #6366f1);
    border-color: var(--c-primary, #6366f1);
    font-weight: 600;
}

/* ---------- 按钮组 ---------- */
.it-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.it-btn {
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-soft, #f3f4f6);
    color: var(--c-text, #111827);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
}
.it-btn:hover { border-color: var(--c-primary, #6366f1); color: var(--c-primary, #6366f1); }
.it-btn.primary {
    background: var(--c-primary, #6366f1);
    border-color: var(--c-primary, #6366f1);
    color: #fff;
}
.it-btn.primary:hover { background: var(--c-primary-dark, #4f46e5); color: #fff; }
.it-btn.ghost { background: transparent; }
.it-btn.block { width: 100%; }
.it-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 水印 ---------- */
.it-color {
    width: 40px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    background: var(--c-bg-soft, #f3f4f6);
    cursor: pointer;
}
.it-wm-preview {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    background: var(--c-bg-soft, #f3f4f6);
    text-align: center;
    font-size: 12px;
    color: var(--c-text-muted, #6b7280);
}
.it-wm-pos-head { margin-top: 12px; }
.it-grid9 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 180px;
}
.it-grid9 button {
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-soft, #f3f4f6);
    color: var(--c-text-sub, #4b5563);
    border-radius: 7px;
    padding: 5px 0;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}
.it-grid9 button.active {
    background: var(--c-primary, #6366f1);
    color: #fff;
    border-color: var(--c-primary, #6366f1);
}

/* ---------- 预览舞台 ---------- */
.it-stage {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}
.it-frame {
    position: relative;
    flex: 1;
    min-height: 380px;
    background:
        linear-gradient(45deg, var(--c-bg-soft, #eee) 25%, transparent 25%, transparent 75%, var(--c-bg-soft, #eee) 75%),
        linear-gradient(45deg, var(--c-bg-soft, #eee) 25%, transparent 25%, transparent 75%, var(--c-bg-soft, #eee) 75%);
    background-color: var(--c-surface, #fff);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
}
.it-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--c-primary, #6366f1);
    border-style: solid;
    z-index: 2;
    pointer-events: none;
}
.it-corner--tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.it-corner--tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.it-corner--bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.it-corner--br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.it-preview {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.it-preview img {
    max-width: 100%;
    max-height: 420px;
    border-radius: 6px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}
.it-empty {
    color: var(--c-text-muted, #6b7280);
    font-size: 14px;
    text-align: center;
    line-height: 1.8;
}

.it-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.it-meta { font-size: 12px; color: var(--c-text-sub, #4b5563); font-variant-numeric: tabular-nums; }
.it-badge {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c-accent-green, #16a34a);
    background: color-mix(in srgb, var(--c-accent-green, #16a34a) 12%, transparent);
    border-radius: 999px;
    padding: 3px 10px;
}

.it-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.it-history { margin-top: 16px; }
.it-history-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text, #111827);
    margin-bottom: 8px;
}
.it-history-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.it-history-item {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--c-border, #e5e7eb);
    cursor: pointer;
    position: relative;
    transition: transform .15s;
    background: var(--c-bg-soft, #f3f4f6);
}
.it-history-item:hover { transform: translateY(-2px); }
.it-history-item img { width: 100%; height: 100%; object-fit: cover; }
.it-history-item .size {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 9px;
    color: #fff;
    background: rgba(11, 18, 33, 0.66);
    text-align: center;
    padding: 1px 0;
}

/* ---------- 信息区 ---------- */
.qg-info {
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 26px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .it-layout { grid-template-columns: 1fr; }
    .it-panel { max-height: none; }
    .it-stage { min-height: 420px; }
    .it-frame { min-height: 300px; }
}
