/* WC Tank Customizer — configurator styles (theme-agnostic, all rules scoped to .wctc-*) */

:root {
	--wctc-accent: #0e7490;
	--wctc-accent-ink: #ffffff;
	--wctc-ink: #111827;
	--wctc-muted: #5b6b7a;
	--wctc-line: #d9e1e8;
	--wctc-bg: #ffffff;
	--wctc-bg-soft: #f4f7f9;
	--wctc-warn: #b45309;
	--wctc-danger: #dc2626;
	--wctc-active: #f59e0b;
	--wctc-radius: 10px;
	--wctc-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html.wctc-open { overflow: hidden; }

/* ---------- launcher on the product page ----------
   Block layout whatever the theme does: flow-root contains a floated theme button, flex-basis 100% claims a
   whole row inside a flex form.cart, and the summary always clears the button instead of wrapping around it. */
.wctc-launcher { display: flow-root; clear: both; width: 100%; flex: 1 1 100%; margin: 0 0 1em; text-align: left; }
.wctc-launcher .wctc-open { display: inline-flex; align-items: center; gap: .5em; float: none; margin: 0; }
.wctc-summary { clear: both; margin-top: .75em; font-size: .92em; line-height: 1.45; color: var(--wctc-muted); }
.wctc-summary.has-mods { padding: .65em .9em; border: 1px solid var(--wctc-line); border-radius: 8px; background: var(--wctc-bg-soft); }
.wctc-summary-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25em 1em; }
.wctc-summary-text { color: var(--wctc-ink); }
.wctc-summary-text strong { font-weight: 600; }
.wctc-summary-actions { display: inline-flex; gap: 1em; white-space: nowrap; }
.wctc-link { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0; min-height: 0; height: auto; width: auto; color: var(--wctc-accent); text-decoration: underline; cursor: pointer; font: inherit; line-height: inherit; text-transform: none; letter-spacing: normal; }
.wctc-link:hover, .wctc-link:focus { color: var(--wctc-ink); background: none; }
.wctc-link-danger { color: var(--wctc-danger); }
.wctc-summary-list { list-style: none; margin: .5em 0 0; padding: .5em 0 0; border-top: 1px solid var(--wctc-line); display: grid; gap: .3em; }
.wctc-summary-list li { display: grid; grid-template-columns: 1.6em minmax(0, max-content) minmax(0, 1fr); gap: 0 .6em; align-items: start; margin: 0; padding: 0; }
.wctc-summary-badge { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--wctc-ink); color: #fff; font-size: .75em; font-weight: 700; margin-top: .2em; }
.wctc-summary-name { color: var(--wctc-ink); font-weight: 600; }
.wctc-summary-pos { color: var(--wctc-muted); }
@media (max-width: 520px) {
	.wctc-summary-list li { grid-template-columns: 1.6em minmax(0, 1fr); }
	.wctc-summary-pos { grid-column: 2; }
}

/* ---------- modal ---------- */
.wctc-modal { position: fixed; inset: 0; z-index: 100000; font-family: var(--wctc-font); color: var(--wctc-ink); font-size: 14px; line-height: 1.4; }
.wctc-modal[hidden] { display: none; }
.wctc-modal *, .wctc-modal *::before, .wctc-modal *::after { box-sizing: border-box; }
.wctc-backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, .55); }
.wctc-dialog { position: absolute; inset: 16px; background: var(--wctc-bg); border-radius: var(--wctc-radius); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }

.wctc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--wctc-line); }
.wctc-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; }
.wctc-sub { margin: 4px 0 0; color: var(--wctc-muted); font-size: 13px; }
.wctc-close { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--wctc-line); background: var(--wctc-bg); font-size: 22px; line-height: 1; cursor: pointer; color: var(--wctc-ink); }
.wctc-close:hover { background: var(--wctc-bg-soft); }

.wctc-body { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 0; }

/* stage */
.wctc-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wctc-bg-soft); border-right: 1px solid var(--wctc-line); }
.wctc-view3d { position: relative; flex: 1 1 44%; min-height: 180px; background: linear-gradient(#f7f9fb, #e6ecf1); overflow: hidden; }
.wctc-view3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.wctc-3d-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--wctc-muted); font-size: 13px; padding: 20px; text-align: center; }
.wctc-3d-hint { position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: var(--wctc-muted); background: rgba(255, 255, 255, .75); padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.wctc-stage.wctc-no-3d .wctc-view3d { flex: 0 0 auto; min-height: 0; height: 48px; }
.wctc-stage.wctc-no-3d .wctc-3d-hint, .wctc-stage.wctc-no-3d .wctc-3d-reset { display: none; }
.wctc-3d-reset { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--wctc-line); background: rgba(255, 255, 255, .85); color: var(--wctc-ink); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.wctc-3d-reset:hover { background: #fff; border-color: var(--wctc-accent); color: var(--wctc-accent); }
.wctc-probe { position: absolute; left: 10px; top: 10px; max-width: 250px; padding: 8px 10px; border: 1px solid var(--wctc-line); border-radius: 8px; background: rgba(255, 255, 255, .93); box-shadow: 0 2px 8px rgba(17, 24, 39, .12); font-size: 12px; }
.wctc-probe-head { font-weight: 700; margin-bottom: 3px; }
.wctc-probe-val { display: flex; flex-direction: column; gap: 2px; }
.wctc-probe-val strong { font-size: 13px; color: var(--wctc-ink); }
.wctc-probe-zone { color: var(--wctc-muted); }
.wctc-probe-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.wctc-probe-btn { font: inherit; font-size: 12px; padding: 3px 9px; border: 1px solid var(--wctc-line); border-radius: 6px; background: var(--wctc-bg); color: var(--wctc-ink); cursor: pointer; }
.wctc-probe-btn:hover:not(:disabled) { background: var(--wctc-bg-soft); }
.wctc-probe-btn:disabled { opacity: .5; cursor: default; }
.wctc-probe-primary { border-color: var(--wctc-accent); color: var(--wctc-accent); font-weight: 600; }
.wctc-stage.wctc-no-3d .wctc-probe { display: none; }
.wctc-drawings { flex: 1 1 56%; min-height: 240px; display: flex; flex-direction: column; border-top: 1px solid var(--wctc-line); background: var(--wctc-bg); }
.wctc-zone-tabs { display: flex; gap: 4px; padding: 8px 12px 0; flex-wrap: wrap; }
.wctc-ztab { border: 1px solid var(--wctc-line); background: var(--wctc-bg-soft); color: var(--wctc-ink); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.wctc-ztab.is-active { background: var(--wctc-accent); border-color: var(--wctc-accent); color: var(--wctc-accent-ink); }
.wctc-drawing-host { flex: 1 1 auto; min-height: 0; padding: 6px 12px; }
.wctc-zone-hint { margin: 0; padding: 0 12px 8px; font-size: 12px; color: var(--wctc-muted); }

/* ---------- drawings ----------
   The SVG drawing rules live in assets/js/wctc-views2d.js (WCTC.Views2D.css) and are injected by the script into
   every document that shows a drawing (configurator, admin order screen, print window). Override them from a
   theme with more specific selectors. */

/* ---------- side panel ---------- */
.wctc-panel { display: flex; flex-direction: column; min-height: 0; background: var(--wctc-bg); position: relative; }
.wctc-panel-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--wctc-line); }
.wctc-ptab { border: 0; background: var(--wctc-bg-soft); padding: 12px 8px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--wctc-muted); border-bottom: 3px solid transparent; }
.wctc-ptab.is-active { background: var(--wctc-bg); color: var(--wctc-ink); border-bottom-color: var(--wctc-accent); }
.wctc-tab { flex: 1 1 auto; overflow: auto; padding: 12px 14px 16px; min-height: 0; }
.wctc-tab[hidden] { display: none; }
.wctc-search { width: 100%; padding: 8px 10px; border: 1px solid var(--wctc-line); border-radius: 8px; font: inherit; margin-bottom: 10px; }
.wctc-notice { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin: 0 0 10px; }
.wctc-cat-title { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--wctc-muted); }
.wctc-cat-title:first-child { margin-top: 0; }
.wctc-cards { display: grid; gap: 6px; }
.wctc-card { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px; border: 1px solid var(--wctc-line); border-radius: 8px; background: var(--wctc-bg); font: inherit; color: var(--wctc-ink); cursor: pointer; }
.wctc-card:hover { border-color: var(--wctc-accent); box-shadow: 0 0 0 2px rgba(14, 116, 144, .12); }
.wctc-card.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.wctc-card-img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: var(--wctc-bg-soft); }
.wctc-card-icon { width: 44px; height: 44px; border-radius: 6px; background: var(--wctc-bg-soft); color: var(--wctc-muted); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.wctc-card-body { display: flex; flex-direction: column; min-width: 0; }
.wctc-card-name { font-weight: 600; }
.wctc-card-size, .wctc-card-price { font-size: 12px; color: var(--wctc-muted); }
.wctc-card-price { color: var(--wctc-ink); }
.wctc-card-add { font-size: 12px; font-weight: 700; color: var(--wctc-accent); white-space: nowrap; }

.wctc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wctc-empty { color: var(--wctc-muted); font-size: 13px; padding: 8px 4px; }
.wctc-item { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--wctc-line); border-radius: 8px; cursor: pointer; }
.wctc-item.is-active { border-color: var(--wctc-active); box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }
.wctc-item.is-invalid { border-color: var(--wctc-danger); }
.wctc-item-badge { width: 24px; height: 24px; border-radius: 50%; background: var(--wctc-ink); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.wctc-item-main { display: flex; flex-direction: column; min-width: 0; }
.wctc-item-name { font-weight: 600; }
.wctc-item-pos { font-size: 12px; color: var(--wctc-muted); }
.wctc-item-err { font-size: 12px; color: var(--wctc-danger); }
.wctc-item-price { font-size: 13px; white-space: nowrap; }
.wctc-item-actions { display: flex; gap: 4px; }
.wctc-mini { border: 1px solid var(--wctc-line); background: var(--wctc-bg); border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; color: var(--wctc-ink); }
.wctc-mini-danger { color: var(--wctc-danger); }
.wctc-mini:hover { background: var(--wctc-bg-soft); }

.wctc-editor { margin-top: 12px; padding: 12px; border: 1px solid var(--wctc-active); border-radius: 10px; background: #fffbeb; }
.wctc-editor[hidden] { display: none; }
.wctc-editor-head { display: flex; align-items: center; gap: 8px; }
.wctc-editor-title { margin: 0; font-size: 15px; }
.wctc-editor-desc { margin: 6px 0 0; font-size: 12px; color: var(--wctc-muted); }
.wctc-editor-price { margin: 4px 0 0; font-size: 12px; }
.wctc-zone-desc { margin: -2px 0 8px; font-size: 12px; color: var(--wctc-muted); }
.wctc-field { display: block; margin-top: 10px; }
.wctc-field-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.wctc-editor select, .wctc-editor input[type="text"], .wctc-editor input[type="number"] { font: inherit; padding: 6px 8px; border: 1px solid var(--wctc-line); border-radius: 6px; background: #fff; color: var(--wctc-ink); }
.wctc-editor select.wctc-zone-select, .wctc-editor input.wctc-note { width: 100%; }
.wctc-params { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.wctc-clock-inputs, .wctc-length-inputs { display: flex; align-items: center; gap: 4px; }
.wctc-hour { width: 64px; }
.wctc-minutes { width: 62px; }
.wctc-length { width: 92px; }
.wctc-colon { font-weight: 700; }
.wctc-deg, .wctc-unit, .wctc-lim { font-size: 11px; color: var(--wctc-muted); }
.wctc-lim { white-space: nowrap; }
.wctc-derived { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 10px 0 0; font-size: 12px; }
.wctc-derived dt { color: var(--wctc-muted); }
.wctc-derived dd { margin: 0; }
.wctc-errors { margin: 10px 0 0; padding: 8px 10px 8px 26px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; color: #991b1b; font-size: 12px; }
.wctc-errors[hidden] { display: none; }
.wctc-editor-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }

.wctc-flash { position: absolute; left: 12px; right: 12px; bottom: 12px; background: var(--wctc-ink); color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 13px; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.wctc-flash.is-visible { opacity: 1; transform: none; }

/* ---------- footer ---------- */
.wctc-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--wctc-line); background: var(--wctc-bg); flex-wrap: wrap; }
.wctc-totals { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--wctc-muted); }
.wctc-totals strong { color: var(--wctc-ink); }
.wctc-total-grand { font-size: 15px; }
.wctc-total-warn { color: var(--wctc-danger); font-weight: 600; }
.wctc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wctc-btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--wctc-accent); background: var(--wctc-bg); color: var(--wctc-accent); cursor: pointer; }
.wctc-btn:hover { background: var(--wctc-bg-soft); }
.wctc-btn-primary { background: var(--wctc-accent); color: var(--wctc-accent-ink); }
.wctc-btn-primary:hover { filter: brightness(1.08); background: var(--wctc-accent); }
.wctc-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.wctc-btn-ghost { border-color: var(--wctc-line); color: var(--wctc-ink); }
.wctc-btn-danger { color: var(--wctc-danger); }
.wctc-preview-note { font-size: 12px; color: var(--wctc-muted); }
.wctc-locked-note { color: var(--wctc-danger); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
	.wctc-dialog { inset: 0; border-radius: 0; }
	/* block flow, not grid: grid auto rows would split the fixed body height instead of growing to content */
	.wctc-body { display: block; overflow: auto; }
	.wctc-stage { border-right: 0; min-height: 0; }
	.wctc-view3d { flex: 0 0 auto; height: 42vh; }
	.wctc-drawings { flex: 0 0 auto; }
	.wctc-drawing-host { height: 60vw; max-height: 420px; }
	.wctc-panel { border-top: 1px solid var(--wctc-line); }
	.wctc-tab { overflow: visible; }
	.wctc-params { grid-template-columns: 1fr; }
}

/* ---------- in-page read-only view (the order spec link for the build team) ---------- */
.wctc-modal.is-inline { position: relative; inset: auto; height: calc(100vh - 110px); min-height: 560px; }
.wctc-modal.is-inline .wctc-dialog { position: relative; inset: auto; height: 100%; box-shadow: none; border: 1px solid var(--wctc-line); }
.wctc-modal.is-readonly .wctc-panel-tabs { grid-template-columns: 1fr; }
.wctc-modal.is-readonly .wctc-item { grid-template-columns: 26px 1fr auto; }
.wctc-item-note { font-size: 12px; color: var(--wctc-ink); font-style: italic; }
.wctc-view-page { margin: 0; padding: 20px; background: var(--wctc-bg-soft); font-family: var(--wctc-font); color: var(--wctc-ink); font-size: 14px; line-height: 1.4; }
.wctc-view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; margin: 0 0 12px; }
.wctc-view-head h1 { font-size: 20px; margin: 0; }
.wctc-view-head p { margin: 2px 0 0; color: var(--wctc-muted); font-size: 13px; }
.wctc-view-brand { font-size: 13px; color: var(--wctc-muted); }
@media (max-width: 960px) {
	.wctc-modal.is-inline { height: auto; min-height: 0; }
	.wctc-modal.is-inline .wctc-dialog { height: auto; }
	.wctc-view-page { padding: 12px; }
}

/* ---------- admin order spec ---------- */
.wctc-admin-spec .wctc-spec-drawings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); justify-items: center; gap: 12px; }
.wctc-admin-spec .wctc-spec-drawings figure { margin: 0; }
.wctc-admin-spec .wctc-spec-drawing { width: 440px; height: 330px; max-width: 100%; }
.wctc-admin-spec .wctc-spec-drawing svg { display: block; width: 100%; height: 100%; }
.wctc-admin-spec figcaption { text-align: center; font-weight: 600; margin-top: 4px; }
.wctc-admin-spec table { width: 100%; border-collapse: collapse; }
.wctc-admin-spec th, .wctc-admin-spec td { border: 1px solid #ddd; padding: 4px 6px; text-align: left; vertical-align: top; }
.wctc-admin-spec ul { margin: 0; padding-left: 14px; }
