/*
 * Flux office · Vânzări: the configurator's list of rows (Input::ROWS) and drawing board (Input::POLYGON).
 * Tokens from fx-tokens.css; the fields themselves (.fx-cfg-input, .fx-cfg-choice) are in fx-sales.css.
 */

/* A field, group or chip not used now stays in the page, hidden (see the configurator view). */
.fx-cfg [hidden] { display: none !important; }

/* A list of rows: each row a small card, its cells in a grid that wraps on phones. */
.fx-rows { display: grid; gap: var(--fx-s-3); }
.fx-rows-row {
    padding: var(--fx-s-3) var(--fx-s-3) var(--fx-s-4) var(--fx-s-4);
    border-radius: var(--fx-r-card);
    background: var(--fx-sunk);
    box-shadow: var(--fx-shadow-inset);
}
html.fx-motion .fx-rows-row { animation: fx-sales-in var(--fx-dur-3) var(--fx-ease-out) backwards; }
.fx-rows-top { display: flex; align-items: center; justify-content: space-between; gap: var(--fx-s-2); margin-bottom: var(--fx-s-2); }
.fx-rows-no {
    display: inline-grid;
    place-items: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 var(--fx-s-2);
    border-radius: var(--fx-r-pill);
    background: var(--fx-graphite);
    color: var(--fx-on-dark);
    font-size: var(--fx-fs-13);
    font-weight: var(--fx-fw-semibold);
    font-variant-numeric: tabular-nums;
}
.fx-rows-cells { display: grid; gap: var(--fx-s-3); grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.fx-rows-cell { min-width: 0; }
.fx-rows-cell.is-main { grid-column: 1 / -1; }
/* Several to a line: a label that wraps keeps its field level with the ones beside it. */
.fx-rows-cell:not(.is-main) > .fx-cfg-label { display: flex; flex-wrap: wrap; align-content: flex-end; column-gap: 0.25em; min-height: 2.6em; }
.fx-rows-note { margin: var(--fx-s-2) 0 0; font-size: var(--fx-fs-13); line-height: 1.45; color: var(--fx-ink-2); overflow-wrap: anywhere; }

/* Remove a row, a corner, a post: a quiet square that never uses the factory's colour. */
.fx-rows-del {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: var(--fx-tap);
    height: var(--fx-tap);
    border-radius: var(--fx-r-ctl);
    background: var(--fx-surface);
    box-shadow: inset 0 0 0 1px var(--fx-line-2);
    color: var(--fx-ink-2);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color var(--fx-dur-1) var(--fx-ease-out), color var(--fx-dur-1) var(--fx-ease-out), transform var(--fx-dur-1) var(--fx-ease-out);
}
.fx-rows-del:active:not(:disabled) { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .fx-rows-del:hover:not(:disabled) { background: var(--fx-hover); color: var(--fx-ink); box-shadow: inset 0 0 0 1px var(--fx-ink-3); } }
.fx-rows-del:disabled { color: var(--fx-ink-disabled); background: transparent; cursor: not-allowed; }

/* Add a row: a dashed outline that becomes solid when pointed at. */
.fx-rows-add {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--fx-tap);
    padding: 0 var(--fx-s-4);
    border: 1px dashed var(--fx-line-2);
    border-radius: var(--fx-r-ctl);
    background: var(--fx-surface);
    color: var(--fx-ink);
    font-size: var(--fx-fs-14);
    font-weight: var(--fx-fw-semibold);
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color var(--fx-dur-2) var(--fx-ease-out), transform var(--fx-dur-1) var(--fx-ease-out);
}
.fx-rows-add:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .fx-rows-add:hover { border-style: solid; border-color: var(--fx-ink-3); } }
.fx-rows-del:focus-visible, .fx-rows-add:focus-visible { outline: var(--fx-focus-width) solid var(--fx-focus-color); outline-offset: var(--fx-focus-offset); }

/* The drawing board. */
.fx-poly { display: grid; gap: var(--fx-s-3); }
.fx-poly [x-cloak] { display: none !important; }
.fx-poly-presets, .fx-poly-modes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fx-s-2); }
.fx-poly-caption { margin-right: var(--fx-s-1); font-size: var(--fx-fs-13); font-weight: var(--fx-fw-semibold); color: var(--fx-ink-2); }
.fx-poly-dims {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--fx-s-3);
    padding: var(--fx-s-3) var(--fx-s-4);
    border-radius: var(--fx-r-card);
    background: var(--fx-sunk);
    box-shadow: var(--fx-shadow-inset);
}
html.fx-motion .fx-poly-dims { animation: fx-sales-in var(--fx-dur-3) var(--fx-ease-out) backwards; }
.fx-poly-dims .fx-cfg-help { flex: 1 1 100%; margin: 0; }
.fx-poly-dim { display: grid; flex: 1 1 9rem; max-width: 14rem; }
.fx-poly-board {
    overflow: hidden;
    border-radius: var(--fx-r-card);
    background: #f7f8fb;
    box-shadow: inset 0 0 0 1px var(--fx-line-2);
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.fx-poly-svg { display: block; width: 100%; height: auto; max-height: 70vh; }
.fx-poly-handle:hover circle, .fx-poly-handle:hover rect { filter: brightness(1.15); }
.fx-poly-lists { display: grid; gap: var(--fx-s-3); grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }
.fx-poly-list {
    display: grid;
    align-content: start;
    gap: var(--fx-s-2);
    padding: var(--fx-s-3) var(--fx-s-3) var(--fx-s-3) var(--fx-s-4);
    border-radius: var(--fx-r-card);
    background: var(--fx-sunk);
    box-shadow: var(--fx-shadow-inset);
}
.fx-poly-list .fx-cfg-help { margin: 0; }
.fx-poly-title { margin: 0; font-size: var(--fx-fs-14); font-weight: var(--fx-fw-strong); color: var(--fx-graphite); }
.fx-poly-item { display: flex; align-items: center; gap: 6px; }
.fx-poly-item select { flex: 1 1 auto; min-width: 0; }
.fx-poly-no { flex: 0 0 auto; min-width: 1.9rem; font-size: var(--fx-fs-13); font-weight: var(--fx-fw-semibold); color: var(--fx-ink-3); font-variant-numeric: tabular-nums; }
.fx-poly-xy { display: flex; align-items: center; gap: 6px; flex: 1 1 0; min-width: 0; font-size: var(--fx-fs-13); font-weight: var(--fx-fw-semibold); color: var(--fx-ink-3); }
.fx-poly-xy .fx-cfg-input { min-width: 0; padding-left: var(--fx-s-2); padding-right: 6px; }

@media (max-width: 639.98px) {
    .fx-rows-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fx-poly-lists { grid-template-columns: minmax(0, 1fr); }
}
