/* Laser Spot Size calculator — scoped styles.
   Prefixed .lss- to avoid clashing with existing site CSS. */

.lss-tool {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    font-family: inherit;
    color: #1a1a1a;
    /* max-width: 1100px; */
}
@media (max-width: 820px) {
    .lss-tool { grid-template-columns: 1fr; }
    .lss-panel { order: 1; }
    .lss-viz-wrap { order: 2; margin-top: 16px; min-height: 300px; }
    .lss-canvas { min-height: 300px; }
    .lss-formula { order: 3; }
    .lss-note { order: 4; }
}

.lss-panel {
    background: #f6f8fa;
    border: 1px solid #dde3ea;
    border-radius: 8px;
    padding: 16px 18px;
}

.lss-field { margin-bottom: 14px; }
.lss-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #33404d;
}
.lss-field input,
.lss-field select {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #c4ccd6;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
}
.lss-field input:focus,
.lss-field select:focus {
    outline: none;
    border-color: #c8102e; /* Edmund red accent */
    box-shadow: 0 0 0 2px rgba(200,16,46,0.12);
}

.lss-inline { display: flex; gap: 10px; }
.lss-inline .lss-field { flex: 1; }

.lss-dist-row { display: flex; gap: 8px; align-items: flex-end; }
.lss-dist-row .lss-field { flex: 1; margin-bottom: 0; }
.lss-dist-row select { width: auto; min-width: 130px; }

.lss-results {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #dde3ea;
}
.lss-result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.lss-result-label { font-size: 13px; color: #55606d; }
.lss-result-value {
    font-size: 18px;
    font-weight: 700;
    color: #c8102e;
    font-variant-numeric: tabular-nums;
}

.lss-viz-wrap {
    display: flex;
    flex-direction: column;
    min-height: 380px;
}
.lss-canvas {
    flex: 1;
    min-height: 380px;
    border: 1px solid #dde3ea;
    border-radius: 8px;
    overflow: hidden;
    background: #0e1118;
}
.lss-hint {
    font-size: 12px;
    color: #8a93a0;
    margin-top: 6px;
    text-align: center;
}

.lss-formula {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    color: #33404d;
    grid-column: 1 / -1;
}
.lss-note {
    font-size: 12px;
    color: #8a93a0;
    grid-column: 1 / -1;
    line-height: 1.5;
}

/* ── Searchable combobox ────────────────────────────────────────── */
.lss-combobox { position: relative; }

.lss-combobox input {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #c4ccd6;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
}
.lss-combobox input:focus {
    outline: none;
    border-color: #c8102e;
    box-shadow: 0 0 0 2px rgba(200,16,46,0.12);
}

.lss-options {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: 100%;
    margin: 3px 0 0;
    padding: 0;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #c4ccd6;
    border-radius: 5px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    display: none;
}
.lss-options.open { display: block; }

.lss-option {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
}
.lss-option:last-child { border-bottom: none; }
.lss-option:hover,
.lss-option.active {
    background: #fdeaec;
    color: #c8102e;
}

.lss-opt-name {
    flex: 1;
    min-width: 0;
    color: #1c2733;
    font-size: 14px;
    font-weight: 700;
}
.lss-stock {
    color: #1c2733;
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}
.lss-option.active .lss-opt-name,
.lss-option.active .lss-stock { color: #c8102e; }

.lss-no-match {
    padding: 8px 10px;
    color: #8a93a0;
    font-size: 12px;
    font-style: italic;
}

/* ── Combobox loading state ─────────────────────────────────────── */
.lss-combobox.lss-loading input {
    background-color: #f6f8fa;
    color: #8a93a0;
    cursor: wait;
}

/* Spinner shown at the right edge of the input while loading */
.lss-combobox.lss-loading::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 14px;
    height: 14px;
    border: 2px solid #c4ccd6;
    border-top-color: #c8102e;
    border-radius: 50%;
    animation: lss-spin 0.7s linear infinite;
    pointer-events: none;
}

@keyframes lss-spin {
    to { transform: rotate(360deg); }
}

.lss-combobox.lss-load-failed input {
    border-color: #c8102e;
    color: #c8102e;
}
.lss-combobox.lss-load-failed input::placeholder { color: #c8102e; }

/* ── Read-only (laser-populated) fields ─────────────────────────── */
.lss-field input[readonly] {
    background-color: #eef1f5;
    color: #33404d;
    border-color: #dde3ea;
    cursor: default;
}
.lss-field input[readonly]:focus {
    outline: none;
    border-color: #dde3ea;
    box-shadow: none;
}
/* Subtle "auto-filled from laser" cue */
.lss-field input[readonly]::placeholder { color: #b3bcc8; }
