/**
 * 截图通用工具弹窗样式（独立，screenshot-tool- 前缀，不与其他面板通用）
 * 可拖动、可缩放（16:9）、深色主题；字体 Microsoft YaHei
 */

.screenshot-tool-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10003;
    pointer-events: none;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
    font-size: 14px;
}

.screenshot-tool-modal-overlay.screenshot-tool-modal--show {
    display: block;
}

.screenshot-tool-modal {
    position: fixed;
    min-width: 800px;
    min-height: 450px;
    background: var(--bg-card, #2b2d31);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-primary, #3d3f44);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

.screenshot-tool-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border-primary, #3d3f44);
    flex-shrink: 0;
    cursor: move;
    user-select: none;
}

.screenshot-tool-modal__title {
    margin: 0;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary, #e8e8e8);
}

.screenshot-tool-modal__close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: #a0a0a0;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-tool-modal__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.screenshot-tool-modal__body {
    flex: 1;
    min-height: 0;
    display: flex;
}

.screenshot-tool-view-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    background: #1a1b1e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 无图时仅显示文字占位，不显示裂图图标 */
.screenshot-tool-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
    font-size: 14px;
    color: var(--text-secondary, #a0a0a0);
    pointer-events: none;
}

.screenshot-tool-view-wrap.screenshot-tool-view-wrap--has-image .screenshot-tool-placeholder {
    display: none;
}

/* 必须锚定左上角：父级为 flex 时，absolute 且未设 inset 会使用「静态位置」常被摆在中心，
   与 JS 里按 (0,0) 为基准的 translate+scale 居中算法冲突，大图缩小时会严重错位、像未适配 */
.screenshot-tool-image-wrap {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: 0 0;
    user-select: none;
}

.screenshot-tool-img {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    display: block;
    user-select: none;
    pointer-events: none;
}

.screenshot-tool-view-wrap:not(.screenshot-tool-view-wrap--has-image) .screenshot-tool-image-wrap {
    visibility: hidden;
}

.screenshot-tool-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.screenshot-tool-overlay-edge {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
}

.screenshot-tool-crop-box {
    position: absolute;
    border: 2px solid #fff;
    pointer-events: none;
}

.screenshot-tool-crop-box::after {
    content: "";
    position: absolute;
    inset: -2px;
    border: 1px dashed rgba(255, 255, 255, 0.6);
}

.screenshot-tool-modal__footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-primary, #3d3f44);
    background: var(--bg-secondary, #25262a);
    flex-shrink: 0;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
}

.screenshot-tool-footer-label {
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
}

.screenshot-tool-resolution {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary, #e8e8e8);
    min-width: 7em;
}

.screenshot-tool-select {
    height: 30px;
    min-width: 88px;
    border-radius: 6px;
    border: 1px solid var(--border-primary, #3d3f44);
    background: #1f2024;
    color: var(--text-primary, #e8e8e8);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
    font-size: 12px;
    padding: 0 8px;
}

.screenshot-tool-quality-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.screenshot-tool-quality-range {
    width: 120px;
    accent-color: #0d6efd;
}

.screenshot-tool-quality-value {
    min-width: 42px;
    font-size: 12px;
    color: var(--text-primary, #e8e8e8);
}

.screenshot-tool-reset-btn,
.screenshot-tool-save-btn {
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", Arial, sans-serif;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border-primary, #3d3f44);
    transition: background 0.2s, color 0.2s;
}

.screenshot-tool-reset-btn {
    background: transparent;
    color: var(--text-primary, #e8e8e8);
}

.screenshot-tool-reset-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.screenshot-tool-save-btn {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.screenshot-tool-save-btn:hover {
    background: #0b5ed7;
}

.screenshot-tool-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.screenshot-tool-save-progress {
    width: 120px;
    height: 8px;
    border-radius: 99px;
    background: #1b1c20;
    border: 1px solid #3b3d42;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.screenshot-tool-save-progress.screenshot-tool-save-progress--show {
    opacity: 1;
}

.screenshot-tool-save-progress__bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #36b3ff);
    transition: width 0.2s ease;
}

.screenshot-tool-modal__resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 1;
}

.screenshot-tool-modal__resize-handle::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 10px;
    height: 10px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    border-radius: 0 0 2px 0;
}

.screenshot-tool-modal__resize-handle:hover::after {
    border-color: #888;
}
