/* =========================================================
   Tutorial Studio
   Canvas Guides / Overlay / Rulers

   文件：/css/main/menu/view/guides.css

   功能：
   1. 标尺
   2. 参考线
   3. 网格与中心线（canvas 绘制，仅需要基础样式）
   4. 安全区域
   5. 智能吸附对齐提示线
   6. 参考线坐标提示
   7. 隐藏元素选框

   说明：
   辅助显示层不会影响页面内容与布局，
   只覆盖在画布之上。
========================================================= */


/* =========================================================
   一、画布辅助显示层
========================================================= */

.ts-canvas-guides {
    position: absolute;

    left: 0;
    top: 0;
    right: 0;
    bottom: 0;

    z-index: 6;

    overflow: hidden;

    /* 辅助显示层默认不拦截鼠标事件。 */
    pointer-events: none;
}


/* 网格与中心线画布 */

.ts-guides-grid {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    display: none;

    pointer-events: none;
}


/* =========================================================
   二、安全区域
========================================================= */

.ts-guides-safe {
    position: absolute;

    border: 1px dashed rgba(255, 92, 138, 0.9);

    background: rgba(255, 92, 138, 0.03);

    pointer-events: none;
}


/* =========================================================
   三、参考线
========================================================= */

.ts-guides-lines {
    position: absolute;

    left: 0;
    top: 0;
    right: 0;
    bottom: 0;

    pointer-events: none;
}


/* 参考线容器：保留较宽的拖动区域。 */

.ts-guide {
    position: absolute;

    pointer-events: auto;

    touch-action: none;

    z-index: 2;
}


/* 垂直参考线：axis = x */

.ts-guide[data-axis="x"] {
    top: 0;
    bottom: 0;

    width: 11px;

    transform: translateX(-50%);

    cursor: ew-resize;
}

.ts-guide[data-axis="x"] .ts-guide-line {
    position: absolute;

    left: 50%;
    top: 0;
    bottom: 0;

    width: 1px;

    margin-left: -0.5px;

    background: rgba(0, 168, 255, 0.9);
}


/* 水平参考线：axis = y */

.ts-guide[data-axis="y"] {
    left: 0;
    right: 0;

    width: auto;
    height: 11px;

    transform: translateY(-50%);

    cursor: ns-resize;
}

.ts-guide[data-axis="y"] .ts-guide-line {
    position: absolute;

    left: 0;
    right: 0;
    top: 50%;

    height: 1px;

    margin-top: -0.5px;

    background: rgba(0, 168, 255, 0.9);
}


/* 悬停与选中 */

.ts-guide:hover .ts-guide-line,
.ts-guide.is-active .ts-guide-line {
    background: #ff2d95;

    box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.25);
}


/* 锁定参考线：不可拖动 */

.ts-canvas-guides.is-locked .ts-guide {
    pointer-events: none;

    cursor: default;
}


/* 隐藏参考线 */

.ts-canvas-guides.is-hidden-guides .ts-guides-lines {
    display: none;
}


/* =========================================================
   四、智能吸附提示线
========================================================= */

.ts-guides-align {
    position: absolute;

    left: 0;
    top: 0;
    right: 0;
    bottom: 0;

    pointer-events: none;

    z-index: 3;
}


.ts-align-guide {
    position: absolute;

    background: #ff2d95;

    pointer-events: none;
}


.ts-align-guide[data-axis="x"] {
    width: 1px;
}


.ts-align-guide[data-axis="y"] {
    height: 1px;
}


/* =========================================================
   五、参考线坐标提示
========================================================= */

.ts-guide-tooltip {
    position: fixed;

    z-index: 1000002;

    padding: 3px 7px;

    border-radius: 5px;

    background: #111827;

    color: #ffffff;

    font-family:
        -apple-system,
        "Segoe UI",
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;

    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;

    white-space: nowrap;

    pointer-events: none;
}


/* =========================================================
   六、标尺
========================================================= */

.ts-rulers {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    z-index: 50;

    pointer-events: none;
}


.ts-rulers[hidden] {
    display: none !important;
}


.ts-ruler {
    position: absolute;

    box-sizing: border-box;

    background: rgba(255, 255, 255, 0.94);

    pointer-events: auto;

    user-select: none;
}


.ts-ruler-horizontal {
    left: 0;
    top: 0;
    right: 0;

    height: 20px;

    border-bottom: 1px solid #e2e6ee;

    cursor: ns-resize;
}


.ts-ruler-vertical {
    left: 0;
    top: 0;
    bottom: 0;

    width: 20px;

    border-right: 1px solid #e2e6ee;

    cursor: ew-resize;
}


.ts-ruler-corner {
    position: absolute;

    left: 0;
    top: 0;

    width: 20px;
    height: 20px;

    z-index: 2;

    box-sizing: border-box;

    background: #f6f7fa;

    border-right: 1px solid #e2e6ee;
    border-bottom: 1px solid #e2e6ee;

    pointer-events: auto;
}


.ts-ruler-canvas {
    display: block;

    width: 100%;
    height: 100%;

    pointer-events: none;
}


/* =========================================================
   七、隐藏元素选框

   只隐藏选框的边线，
   缩放和旋转控制点仍然保留，
   避免关闭选框后无法继续调整元素。
========================================================= */

body.ts-hide-selection-box #selectionBox {
    border-color: transparent !important;

    box-shadow: none !important;
}


/* =========================================================
   八、窄屏适配
========================================================= */

@media (max-width: 900px) {

    .ts-ruler-horizontal,
    .ts-ruler-vertical,
    .ts-ruler-corner {
        display: none;
    }
}
