/* Copyright (c) 2026 Yuheng. All rights reserved. Unauthorised copying, reuse or redistribution is not permitted. */
/* ==========================================
   CIRCUIT LAB: SCHEMATIC EXPORT DIALOG
========================================== */

.cl-sch {
    position: fixed;
    inset: 0;
    z-index: 99996;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--t-surface-26354a-a55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cl-sch.visible {
    opacity: 1;
    visibility: visible;
}

body.cl-sch-open {
    overflow: hidden;
}

.cl-sch-window {
    display: flex;
    flex-direction: column;
    width: min(1380px, 100%);
    height: min(860px, 100%);
    overflow: hidden;
    border: 1px solid var(--t-border-dce4f0);
    border-radius: 20px;
    background: var(--t-surface-ffffff);
    color: var(--t-text-26354a);
    box-shadow: 0 30px 80px rgba(10, 20, 40, 0.4);
    transform: translateY(14px) scale(0.985);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cl-sch.visible .cl-sch-window {
    transform: none;
}

.cl-sch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px 12px 20px;
    border-bottom: 1px solid var(--t-border-dce4f0);
    background: var(--t-surface-f7f9fc);
}

.cl-sch-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cl-sch-heading svg {
    width: 22px;
    height: 22px;
    flex: none;
    fill: none;
    stroke: #3F72C5;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cl-sch-heading h2 {
    margin: 0;
    font-size: 18px;
}

.cl-sch-stats {
    color: var(--t-text-7b8798);
    font-size: 13px;
    font-weight: 700;
}

.cl-sch-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    flex: 1;
    min-height: 0;
}

.cl-sch-preview {
    overflow: auto;
    padding: 22px;
    background:
        radial-gradient(ellipse 80% 70% at 50% 30%, rgba(120, 140, 175, 0.18), transparent 70%),
        var(--t-surface-f7f9fc);
}

.cl-sch-preview svg {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 3px;
    box-shadow: 0 12px 34px rgba(20, 30, 55, 0.28), 0 0 0 1px rgba(20, 30, 55, 0.12);
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.cl-sch-error {
    margin: 40px auto;
    max-width: 380px;
    text-align: center;
    color: var(--t-text-7b8798);
}

.cl-sch-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: auto;
    padding: 18px;
    border-left: 1px solid var(--t-border-dce4f0);
}

.cl-sch-note {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--t-surface-f7f9fc);
    border: 1px solid var(--t-border-dce4f0);
    color: var(--t-text-7b8798);
    font-size: 12.5px;
    line-height: 1.45;
}

.cl-sch-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.cl-sch-field > span {
    color: var(--t-text-7b8798);
    font-size: 12px;
    font-weight: 800;
}

.cl-sch-field input[type="text"] {
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--t-border-dce4f0);
    border-radius: 10px;
    background: var(--t-surface-ffffff);
    color: inherit;
    font: inherit;
    font-size: 14px;
}

.cl-sch-field input[type="text"]:focus {
    outline: none;
    border-color: #4A80D8;
    box-shadow: 0 0 0 3px rgba(74, 128, 216, 0.2);
}

.cl-sch-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cl-sch-checks {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.cl-sch-checks label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.cl-sch-checks input {
    width: 16px;
    height: 16px;
    accent-color: #3F72C5;
}

.cl-sch-zoom {
    display: inline-grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 3px;
    border: 1px solid var(--t-border-dce4f0);
    border-radius: 11px;
    background: var(--t-surface-f7f9fc);
}

.cl-sch-zoom-button {
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--t-text-7b8798);
    font: inherit;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cl-sch-zoom-button.is-on {
    background: linear-gradient(135deg, #4C82DA, #2F5FB8);
    color: #fff;
}

.cl-sch-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: auto;
}

.cl-sch-actions .cl-button {
    justify-content: center;
    padding-inline: 6px;
}

.cl-sch-actions.is-small {
    display: flex;
    gap: 16px;
    margin-top: 0;
}

.cl-sch-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 900px) {

    .cl-sch {
        padding: 0;
    }

    .cl-sch-window {
        height: 100%;
        border-radius: 0;
    }

    .cl-sch-body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        overflow: auto;
    }

    .cl-sch-options {
        border-left: 0;
        border-top: 1px solid var(--t-border-dce4f0);
        overflow: visible;
    }

    .cl-sch-preview {
        min-height: 40vh;
    }

}

@media (prefers-reduced-motion: reduce) {

    .cl-sch,
    .cl-sch-window,
    .cl-sch-preview svg {
        transition: none;
    }

}


/* ---------- editing the drawing ---------- */

.cl-sch-preview svg [data-sch] {
    cursor: move;
    touch-action: none;
}

.cl-sch-preview svg .sch-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 9;
    stroke-linecap: round;
    pointer-events: stroke;
}

.cl-sch-preview svg .sch-hit-box {
    fill: transparent;
    stroke: none;
    pointer-events: all;
}

.cl-sch-preview svg .sch-sel {
    fill: rgba(59, 130, 246, 0.08);
    stroke: #3b82f6;
    stroke-width: 1.2;
    stroke-dasharray: 5 3;
    pointer-events: none;
}

.cl-sch-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--t-border-e3e9f2);
    border-radius: 12px;
}

.cl-sch-edit .cl-sch-note {
    margin: 0;
}

.cl-sch-edit-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.cl-sch-edit-info {
    min-height: 1.2em;
    color: var(--t-text-7b8798);
    font-size: 12.5px;
    font-weight: 600;
}
