/* Image Annotate – baut auf base.css (identisch mit dem STIHL Video Editor) auf. */
@import url(base.css);
@import url(icons.css);

/* ---------- Navigation im Header ---------- */
.topbar .brand { flex: none; }
@media (max-width: 1180px) { .topbar .platform-name { display: none; } }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a { font: .875rem/1 var(--font-bold); text-decoration: none; padding: 8px 12px; color: var(--grey-dark); border-bottom: 2px solid transparent; }
.mainnav a:hover { color: var(--text); }
.mainnav a.on { color: var(--text); border-bottom-color: var(--orange); }

.page { max-width: 1120px; margin: 0 auto; padding: 48px 24px 96px; display: grid; gap: 32px; }
.intro p { margin: 16px 0 0; color: var(--muted); max-width: 680px; }

/* ---------- Produkt-Navigation im Editor ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .875rem; white-space: nowrap; }
.crumbs a { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.topbar input.title { min-width: 80px; }
@media (max-width: 1100px) { .topbar .crumbs { display: none; } }
.crumbs a { font-family: var(--font-bold); color: var(--grey-dark); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.setnav { display: flex; align-items: center; gap: 4px; font-size: .8125rem; white-space: nowrap; }
.setnav .btn { min-height: 28px; width: 28px; padding: 0; border-color: transparent; font-size: 1.125rem; }
.setnav .btn.disabled { opacity: .3; pointer-events: none; }
.setnav small { color: var(--grey-dark); }
.copy-list { max-height: 320px; overflow-y: auto; }

/* ---------- Produktseite ---------- */
.set-title { font-family: var(--font-display); font-size: 1.25rem; text-transform: uppercase; font-size-adjust: cap-height .68; }
.product-head { display: grid; grid-template-columns: 1fr 220px 220px 120px; gap: 16px; align-items: end; }
.heading-input { font: 2rem/1.1 var(--font-display); text-transform: uppercase; height: auto; padding: 4px 8px; border-color: transparent; }
.heading-input:hover { border-color: var(--grey-base); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.scard { background: var(--panel); box-shadow: var(--shadow-m); display: grid; grid-template-rows: auto 1fr auto; cursor: grab; }
.scard .thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.scard .thumb svg { width: 100%; height: 100%; display: block; }
.scard .thumb .ph { color: var(--grey-dark); font-size: .75rem; }
.scard .body { padding: 12px 14px 8px; display: grid; gap: 4px; align-content: start; }
.scard .name { font: .875rem/1.3 var(--font-bold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .meta { font-size: .75rem; color: var(--muted); }
.scard .actions { display: flex; gap: 8px; padding: 0 14px 14px; justify-content: space-between; }
.scard .grip { width: 12px; height: 14px; opacity: .4; background: radial-gradient(circle, var(--grey-ultra-deep) 1px, transparent 1.5px) 0 0 / 4px 4px; }
.scard.dragging { opacity: .4; }
.scard.drop-before { box-shadow: -4px 0 0 var(--orange), var(--shadow-m); }
.scard.drop-after { box-shadow: 4px 0 0 var(--orange), var(--shadow-m); }
.scard.over { opacity: .65; }
.slot { font: .75rem/1.33 var(--font-demi); padding: 2px 8px; background: var(--grey-light); }
.slot.main { background: var(--orange); color: #fff; }
.chk-count.error { color: var(--red); }
.chk-count.warn { color: var(--yellow-deep); }
.pcard .thumb.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); place-items: stretch; gap: 2px; background: var(--line); }
.pcard .thumb.mosaic img { width: 100%; height: 100%; min-height: 0; max-width: none; max-height: none; object-fit: contain; background: #fff; }
.pcard .thumb.mosaic span { background: #fff; }
.pcard .thumb.mosaic .ph { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; }
@media (max-width: 900px) { .product-head { grid-template-columns: 1fr 1fr; } }

/* ---------- Projektübersicht ---------- */
.create { display: grid; grid-template-columns: 1fr 220px auto; gap: 8px; align-items: end; }
.create input, .create select { height: 48px; padding: 0 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.pcard { background: var(--panel); box-shadow: var(--shadow-m); display: grid; grid-template-rows: auto 1fr; transition: box-shadow 100ms linear; color: inherit; text-decoration: none; }
.pcard:hover { box-shadow: 0 2px 12px 0 rgba(0,0,0,.16), 0 1px 2px 0 rgba(0,0,0,.2); color: inherit; }
.pcard .thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.pcard .thumb img { max-width: 86%; max-height: 86%; object-fit: contain; }
.pcard .thumb .ph { color: var(--grey-base); font-size: .875rem; }
.pcard .body { padding: 16px; display: grid; gap: 4px; align-content: start; }
.pcard h2 { font: 1rem/1.25 var(--font-bold); }
.pcard .meta { font-size: .75rem; color: var(--muted); }
.pcard .actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.empty { padding: 48px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--grey-base); }
@media (max-width: 720px) { .create { grid-template-columns: 1fr; } }

/* ---------- Editor-Layout ---------- */
.editor { display: grid; grid-template-columns: 56px minmax(0, 1fr) 360px; height: calc(100vh - 64px); }
.toolbar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; }
.toolbar .sep { width: 32px; height: 1px; background: var(--line); margin: 6px 0; }
.toolbar button { width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; position: relative; }
.toolbar button .ico { width: 18px; height: 18px; }
.toolbar button.on { background: var(--grey-ultra-deep); color: #fff; }
.toolbar button.on:hover { background: var(--grey-ultra-deep); color: #fff; }
.toolbar button[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: var(--grey-ultra-deep); color: #fff; font: .75rem/1 var(--font-demi); padding: 6px 8px; white-space: nowrap; z-index: 20; pointer-events: none;
}

.workspace { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); min-width: 0; background: var(--grey-light); }
.wbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.wbar .zoom { font: .75rem var(--mono); min-width: 44px; text-align: center; }
.wbar .grow { flex: 1; min-width: 0; }
.wbar label.check { white-space: nowrap; }
@media (max-width: 1100px) { .wbar .cursor-pos { display: none; } }
.wbar .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbar .cursor-pos { font-size: .75rem; color: var(--grey-dark); min-width: 120px; text-align: right; white-space: nowrap; }
.viewport { position: relative; overflow: auto; display: grid; place-items: center; padding: 40px; }
.artboard { position: relative; box-shadow: var(--shadow-m); background: #fff; flex: none; }
.artboard.transparent { background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.artboard svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.artboard svg.scene { font-size-adjust: none; user-select: none; }
.artboard svg.scene g[data-id] { cursor: move; }
.artboard svg.scene.tool-create, .artboard svg.scene.tool-create g[data-id] { cursor: crosshair; }
.artboard svg.overlay { pointer-events: none; }
.artboard.clip svg.scene { overflow: hidden; }
.artboard svg.overlay .handle { pointer-events: all; cursor: grab; }
.artboard .drop { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--grey-dark); border: 2px dashed var(--grey-base); margin: 24px; background: rgba(255,255,255,.85); }
.artboard .drop.over { border-color: var(--orange); color: var(--text); }

/* Inline-Texteingabe direkt auf dem Bild */
.inline-edit { position: absolute; z-index: 5; display: grid; gap: 6px; background: #fff; padding: 10px; box-shadow: var(--shadow-l); width: 320px; }
.inline-edit textarea { resize: none; }
.inline-edit .counter { font-size: .75rem; color: var(--grey-dark); text-align: right; }

/* ---------- Eigenschaften-Panel ---------- */
.side { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.side .section > h3 .ico { width: 14px; height: 14px; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 3px 4px; }
.seg button .ico { width: 14px; height: 14px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid var(--grey-base); }
.swatch.on { outline: 2px solid var(--grey-ultra-deep); outline-offset: 2px; }
.counter { display: flex; justify-content: space-between; font-size: .75rem; line-height: 1.33; color: var(--grey-dark); font-variant-numeric: tabular-nums; }
.counter .err { color: var(--red); }
.field-stack { display: grid; gap: 4px; align-content: start; }
.missing-note { font-size: .75rem; color: var(--grey-dark); }
.missing-note b { color: var(--text); }

.layers { display: grid; gap: 2px; }
.layer { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; background: var(--grey-ultra-light); border-left: 4px solid transparent; cursor: pointer; font-size: .875rem; }
.layer:hover { background: var(--grey-light); }
.layer.on { border-left-color: var(--orange); background: var(--orange-light); }
.layer.off .name { color: var(--grey-base); }
.layer .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .ico { width: 14px; height: 14px; }
/* Ebenen per Drag & Drop */
.layer { grid-template-columns: 8px 20px 1fr auto; }
.layer .grip { width: 8px; height: 14px; cursor: grab; opacity: .35;
  background: radial-gradient(circle, var(--grey-ultra-deep) 1px, transparent 1.5px) 0 0 / 4px 4px; }
.layer:hover .grip { opacity: .7; }
.layer.dragging { opacity: .4; }
.layer.drop-before { box-shadow: inset 0 2px 0 var(--orange); }
.layer.drop-after { box-shadow: inset 0 -2px 0 var(--orange); }
.layer.image-layer { background: var(--grey-light); }
.layer.image-layer.on { background: var(--orange-light); }
.layer .name small { color: var(--grey-dark); font-size: .6875rem; }
.layer .tools { display: flex; gap: 2px; }
.layer .tools button { width: 24px; height: 24px; min-height: 24px; padding: 0; border: 0; }
.layer .tools button .ico { width: 12px; height: 12px; }
/* Normalzustand (sichtbar, offen) dezent, Ausnahmezustand (ausgeblendet, gesperrt) kräftig. */
.layer .tools button .ico { opacity: .28; transition: opacity 100ms linear; }
.layer:hover .tools button .ico { opacity: .5; }
.layer .tools button:hover .ico { opacity: .85; }
.layer .tools button.active .ico { opacity: 1; }
.layer .tools button.active { background: var(--grey-light); }
.layer.locked .name { color: var(--grey-dark); }

.checks { display: grid; gap: 6px; font-size: .8125rem; line-height: 1.35; }
.chk { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; }
.chk .ico { width: 14px; height: 14px; margin-top: 2px; }
.chk.ok .ico { color: var(--green); }
.chk.warn .ico { color: var(--yellow-deep); }
.chk.error .ico { color: var(--red); }

/* Position & Ausrichten */
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.coords input { height: 32px; }
.readout { font-size: .8125rem; padding-top: 6px; }
.arrange { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.grid9 { display: grid; grid-template-columns: repeat(3, 28px); grid-template-rows: repeat(3, 28px); gap: 2px; padding: 2px; background: var(--grey-light); }
.grid9 .cell { min-height: 0; width: 28px; height: 28px; padding: 0; border: 0; background: #fff; display: grid; place-items: center; }
.grid9 .cell i { width: 8px; height: 8px; background: var(--grey-base); }
.grid9 .cell:hover:not(:disabled) i { background: var(--orange); }
.grid9 .cell:hover:not(:disabled) { background: #fff; }
.vsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
button.sm .ico { width: 12px; height: 12px; }

/* Skalierung Produktbild: Zone über 120 % orange markiert */
.scale-row { display: grid; grid-template-columns: 1fr 88px; gap: 12px; align-items: start; }
.scale-track { position: relative; padding-bottom: 14px; }
.scale-range { width: 100%; height: 20px; border: 0; padding: 0; accent-color: var(--grey-ultra-deep); }
.scale-marks { position: absolute; left: 8px; right: 8px; bottom: 0; height: 12px; pointer-events: none;
  background: linear-gradient(90deg, transparent 39%, var(--orange) 39%) top / 100% 3px no-repeat; }
.scale-marks span { position: absolute; top: 4px; font: .625rem/1 var(--mono); color: var(--orange-deep, #B85A12); white-space: nowrap; }
.scale-marks span.tick { top: 0; width: 1px; height: 8px; background: var(--grey-dark); }

/* Icon-Bibliothek */
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.lib-item { display: grid; gap: 4px; justify-items: center; padding: 8px 4px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .6875rem; line-height: 1.2; text-align: center; min-height: 0; font-family: var(--font-regular); color: var(--text); white-space: normal; }
.lib-item:hover { border-color: var(--grey-ultra-deep); background: #fff; }
.lib-item.on { outline: 2px solid var(--orange); outline-offset: -2px; }
.lib-item img { width: 44px; height: 44px; object-fit: contain; }
.library.wide { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.library.wide .lib-item img { width: 72px; height: 52px; }
.lib-cat { font: .75rem/1 var(--font-bold); color: var(--grey-dark); margin-top: 8px; grid-column: 1 / -1; }

/* ---------- Export-Dialog ---------- */
.modal.wide { width: 640px; }
.modal h2 { font-family: var(--font-display); font-size: 1.25rem; text-transform: uppercase; font-size-adjust: cap-height .68; }
.optlist { display: grid; gap: 8px; }
.result { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .8125rem; padding: 8px 0; border-top: 1px solid var(--line); }
.result .err { color: var(--red); grid-column: 1 / -1; }

/* ---------- Styleguide ---------- */
.sg { display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 32px; align-items: start; }
.sg-preview { position: sticky; top: 24px; display: grid; gap: 12px; }
.sg-preview .artboard { width: 100%; max-width: 620px; aspect-ratio: 1; }
.sg-card { background: var(--panel); box-shadow: var(--shadow-m); padding: 24px; display: grid; gap: 16px; }
.sg-card > h2 { font-family: var(--font-display); font-size: 1.25rem; text-transform: uppercase; font-size-adjust: cap-height .68; display: flex; justify-content: space-between; align-items: center; }
.sg-card > p { margin: -8px 0 0; color: var(--muted); font-size: .875rem; }
.sg-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); align-items: end; }
.style-item { border: 1px solid var(--line); padding: 12px; display: grid; gap: 12px; }
.style-item .sample { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.palette-item { display: grid; grid-template-columns: 40px 1fr 110px auto; gap: 8px; align-items: center; }
.icon-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.icon-admin .lib-item { cursor: default; grid-template-rows: 56px auto auto; }
.icon-admin input { height: 28px; font-size: .75rem; }
.icon-admin.wide .lib-item { grid-template-rows: 72px auto auto; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: .875rem; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.rules b { font-family: var(--font-display); text-transform: uppercase; font-size-adjust: cap-height .68; }
@media (max-width: 1100px) { .sg { grid-template-columns: 1fr; } .sg-preview { position: static; } }
