/* AFFIQ TOOLS VISUAL FOUNDATION — layout only; codec and editor logic remain tool-owned. */
/* Shared shell geometry; each tool keeps its established palette and components. */
.affiq-tools-page {
  --tools-gutter: clamp(16px, 2.4vw, 48px);
  --tools-content-max: 1680px;
  --tools-header-max: 1980px;
  --tools-shell-line: #2c3945;
  --tools-shell-text: #f2f4f7;
  --tools-shell-muted: #a6b7c7;
  --tools-accent-color: #3b82f6;
  --tools-surface-color: #12161f;
  --tools-free-fg: #72e8b0;
  --tools-free-bg: #103026;
  --tools-free-line: #236647;
  font-family: "Segoe UI", system-ui, sans-serif;
}
/* Keep the SVG tool's footer anchored at the bottom in compact upload state. */
.affiq-tools-page[data-affiq-tool="image-to-svg"] {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-main { flex: 1; }
.affiq-tools-page[data-affiq-tool="image-to-svg"] {
  --tools-shell-line: #30424e;
  --tools-shell-text: #e9f0f4;
  --tools-shell-muted: #aabfce;
  --tools-accent-color: #a2e4cb;
  --tools-surface-color: #101b25;
}
.affiq-tools-page[data-affiq-tool="image-compressor"] {
  --tools-shell-line: #394149;
  --tools-shell-text: #f2efea;
  --tools-shell-muted: #a4adb5;
  --tools-accent-color: #d6aa70;
  --tools-surface-color: #1c2228;
}
/* Full-width header, with safely padded content on all display sizes. */
.affiq-tools-page .affiq-tools-header {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 56px;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--tools-shell-line);
  background: inherit;
  color: var(--tools-shell-text);
  display: block;
  flex: none;
  z-index: 20;
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-header {
  position: sticky;
  top: 0;
  background: #0a0c10;
}
.affiq-tools-header-inner {
  box-sizing: border-box;
  min-height: 56px;
  width: calc(100% - 2 * var(--tools-gutter));
  max-width: var(--tools-header-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.affiq-tools-page .affiq-tools-title {
  margin: 0;
  padding: 0;
  font: 650 clamp(15px, 1.35vw, 18px)/1.3 "Segoe UI", system-ui, sans-serif;
  letter-spacing: -.025em;
  color: var(--tools-shell-text);
}
.affiq-tools-title .tool-title-dot { color: var(--tools-accent-color); }
.affiq-tools-page .affiq-tools-free {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--tools-free-line);
  border-radius: 999px;
  background: var(--tools-free-bg);
  padding: 4px 10px;
  color: var(--tools-free-fg);
  font: 600 11px/1.4 "Segoe UI", system-ui, sans-serif;
  white-space: nowrap;
}
.affiq-tools-free-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
/* Content is wide on desktops but not stretched indefinitely on ultrawide screens. */
.affiq-tools-page .affiq-tools-main {
  box-sizing: border-box;
  width: calc(100% - 2 * var(--tools-gutter));
  max-width: var(--tools-content-max);
  margin-inline: auto;
  padding-inline: 0;
  min-width: 0;
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-main {
  padding-top: clamp(12px, 2.2vh, 24px);
  padding-bottom: clamp(12px, 2.2vh, 24px);
}
/* Preserve compressor's desktop flex sizing after normalizing header classes. */
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Reserve a deliberate gap before the fixed-height desktop footer. */
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-main {
  padding-bottom: clamp(10px, 1.6vh, 16px);
}
.affiq-tools-page .affiq-tools-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 36px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--tools-shell-line);
  border-radius: 8px;
  background: transparent;
  color: var(--tools-shell-muted);
  font: 600 12px/1.45 "Segoe UI", system-ui, sans-serif;
  text-decoration: none;
  box-shadow: none;
}
.affiq-tools-page .affiq-tools-back:hover {
  background: var(--tools-surface-color);
  border-color: var(--tools-accent-color);
  color: var(--tools-shell-text);
}
.affiq-tools-page .affiq-tools-back:focus-visible {
  outline: 2px solid var(--tools-accent-color);
  outline-offset: 3px;
}
/* Shared visual geometry; internal tool workflows and buttons remain independent. */
.affiq-tools-page .affiq-tools-workspace { border-radius: 12px; }
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-workspace {
  max-width: 100%;
}
/* Keep the result editor readable without stretching its controls across widescreens. */
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-workspace:has(#resultState:not(.hidden)) {
  width: min(100%, 1240px);
  margin-inline: auto;
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-workspace:has(#uploadState:not(.hidden)) {
  width: min(100%, 1080px);
  margin-inline: auto;
}
.affiq-tools-page[data-affiq-tool="background-remover"] #dropZone {
  min-height: clamp(215px, 32vh, 295px);
  border-radius: 12px;
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-main > .text-center {
  margin-bottom: 14px;
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-main > .text-center h1 {
  margin-bottom: 4px;
  font-size: clamp(24px, 2.5vw, 32px);
}
.affiq-tools-page[data-affiq-tool="background-remover"] .affiq-tools-main > .text-center p:last-child {
  max-width: 600px;
}
/* Compact empty state: no giant blank preview before someone chooses a file. */
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]),
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) {
  width: min(100%, 900px);
  margin-inline: auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  flex: 0 0 auto;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) .preview-area,
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .preview-area {
  display: none;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) .controls,
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .controls {
  border: 0;
  border-radius: 11px;
  padding: clamp(18px, 2.5vw, 30px);
  overflow: visible;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) #settings,
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .settings-section,
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .compress-section,
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) #reset {
  display: none;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) .drop label {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: clamp(175px, 25vh, 265px);
  gap: 5px;
}
.affiq-tools-page[data-affiq-tool="image-to-svg"] .affiq-tools-workspace:has(#fileInfo[hidden]) .drop small {
  grid-column: auto;
}
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .drop {
  min-height: clamp(175px, 25vh, 265px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-workspace:has(#file-info[hidden]) .status {
  text-align: center;
}
/* Small, consistent typography and control surface corners without changing behavior. */
.affiq-tools-page .affiq-tools-workspace :is(button,select) {
  border-radius: 8px;
}
.affiq-tools-page .affiq-tools-footer {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 42px;
  margin: 0;
  padding: 8px var(--tools-gutter);
  border-top: 1px solid var(--tools-shell-line);
  color: var(--tools-shell-muted);
  background: transparent;
  font-size: 11px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  gap: 8px;
  align-items: center;
}
.affiq-tools-page .affiq-tools-footer > :first-child {
  grid-column: 2;
  justify-self: center;
  text-align: center;
}
.affiq-tools-page .affiq-tools-footer > details {
  grid-column: 3;
  justify-self: end;
}
.affiq-tools-page .affiq-tools-footer a { color: var(--tools-shell-text); }
@media (max-width: 760px) {
  .affiq-tools-page .affiq-tools-header-inner { min-height: 52px; }
  .affiq-tools-page .affiq-tools-title { font-size: 15px; }
  .affiq-tools-page .affiq-tools-free { font-size: 10px; padding: 4px 8px; }
  .affiq-tools-page .affiq-tools-main { width: calc(100% - 2 * var(--tools-gutter)); }
  .affiq-tools-page[data-affiq-tool="image-compressor"] .affiq-tools-main {
    display: block;
    flex: none;
  }
  .affiq-tools-page .affiq-tools-back { min-height: 44px; }
  .affiq-tools-page .affiq-tools-footer { display: flex; flex-direction: column; gap: 3px; padding-block: 12px; text-align: center; }
  .affiq-tools-page .affiq-tools-footer > :first-child,
  .affiq-tools-page .affiq-tools-footer > details { grid-column: auto; justify-self: auto; }
}
@media (max-width: 360px) {
  .affiq-tools-page .affiq-tools-header-inner { gap: 8px; }
  .affiq-tools-page .affiq-tools-title { font-size: 14px; }
}
