/**
 * Image resizer tool UI — matches kodotools mock layout; uses page :root tokens.
 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

.resize-tool-root {
  --rt-border: var(--line, #e6e2d6);
  --rt-soft: var(--ink-muted, #8b8680);
  --rt-mid: var(--ink-soft, #4a4a4a);
  --rt-brand: var(--accent, #ff4d2b);
  --rt-brand-bg: var(--accent-soft, #fff0eb);
  --rt-green: var(--success, #10b981);
  --rt-green-bg: rgba(16, 185, 129, 0.1);
  --rt-radius: 14px;
  --rt-radius-sm: 8px;
  --rt-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.resize-tool-root .sr-only,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.resize-tool-card {
  background: var(--card, #fff);
  border-radius: 20px;
  border: 1px solid var(--rt-border);
  box-shadow: var(--rt-shadow);
  overflow: hidden;
}

/* ── Presets bar ── */
.resize-presets-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rt-border);
  background: var(--bg-warm, #faf8f2);
}

.resize-presets-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--rt-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

/* Stacked rows: icon + category left, preset chips flow right (matches horizontal preset mock) */
.resize-presets-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--card, #fff);
  border: 1px solid var(--rt-border);
  border-radius: 14px;
  padding: 4px 4px 4px 8px;
}

.resize-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.resize-preset-row:last-child {
  border-bottom: none;
}

.resize-preset-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: min(140px, 100%);
  padding-top: 4px;
}

.resize-preset-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-warm, #faf8f2);
  border: 1px solid var(--rt-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rt-mid);
  font-size: 16px;
  flex-shrink: 0;
}

.resize-preset-row--accent .resize-preset-row-icon {
  color: var(--rt-brand);
  background: var(--rt-brand-bg);
  border-color: rgba(255, 77, 43, 0.22);
}

.resize-preset-row-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--rt-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.resize-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  align-content: flex-start;
  flex: 1 1 180px;
  min-width: 0;
}

.resize-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 14px;
  border-radius: var(--rt-radius-sm);
  border: 1.5px solid var(--rt-border);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-width: 88px;
  flex: 0 1 auto;
  width: auto;
  max-width: 140px;
  text-align: center;
  font-family: inherit;
}

.resize-preset-row--accent .resize-preset-btn:not(.active) .resize-preset-name {
  color: var(--rt-brand);
}

.resize-preset-btn:hover:not(.active) {
  border-color: color-mix(in srgb, var(--rt-border) 70%, var(--rt-mid));
  background: var(--bg-warm, #faf8f2);
}

.resize-preset-btn.active {
  border-color: var(--rt-brand);
  background: var(--rt-brand-bg);
}

.resize-preset-btn.active .resize-preset-name {
  color: var(--rt-brand);
}

.resize-preset-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #0a0a0a);
}

.resize-preset-dims {
  font-size: 10px;
  color: var(--rt-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Body grid ── */
.resize-tool-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 380px;
}

@media (max-width: 900px) {
  .resize-tool-body {
    grid-template-columns: 1fr;
  }
  .resize-tool-col--controls {
    border-right: none !important;
    border-bottom: 1px solid var(--rt-border);
  }
}

.resize-tool-col--controls {
  padding: 20px;
  border-right: 1px solid var(--rt-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.resize-tool-col--preview {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fafafa;
}

/* ── Drop zone ── */
.resize-drop-zone {
  border: 2px dashed var(--rt-border);
  border-radius: var(--rt-radius);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-warm, #faf8f2);
  flex-shrink: 0;
}

.resize-drop-zone:hover,
.resize-drop-zone.resize-drop-zone--drag {
  border-color: var(--rt-brand);
  background: var(--rt-brand-bg);
}

.resize-drop-zone.has-files {
  border-color: var(--rt-green);
  background: var(--rt-green-bg);
  border-style: solid;
  padding: 14px 18px;
}

.resize-drop-inner-empty .resize-drop-icon {
  width: 44px;
  height: 44px;
  background: var(--rt-brand-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--rt-brand);
  font-size: 20px;
}

.resize-drop-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #0a0a0a);
  margin-bottom: 4px;
}

.resize-drop-sub {
  font-size: 12px;
  color: var(--rt-soft);
}

.resize-drop-cta {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  background: var(--rt-brand);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.resize-drop-cta:hover {
  filter: brightness(0.95);
}

.resize-formats-note {
  font-size: 11px;
  color: var(--rt-soft);
  margin-top: 8px;
}

.resize-drop-zone.has-files .resize-drop-inner-empty {
  display: none;
}

.resize-drop-inner-loaded {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resize-drop-zone.has-files .resize-drop-inner-loaded {
  display: flex;
}

.resize-drop-title--ok {
  font-size: 13px;
  margin: 0;
  color: var(--rt-green);
}

.resize-drop-check {
  font-size: 18px;
  color: var(--rt-green);
}

/* ── Settings ── */
.resize-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resize-settings-row--dims {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.resize-field {
  flex: 1;
  min-width: 0;
}

.resize-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--rt-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.resize-field-input,
.resize-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
  font-size: 14px;
  color: var(--ink, #0a0a0a);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.resize-field-input {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.resize-field-input:focus,
.resize-select:focus {
  border-color: var(--rt-brand);
}

.resize-select {
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.resize-lock-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--rt-mid);
  transition: all 0.15s;
}

.resize-lock-btn.locked {
  border-color: var(--rt-brand);
  background: var(--rt-brand-bg);
  color: var(--rt-brand);
}

.resize-quality-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resize-quality-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.resize-quality-head .resize-field-label {
  margin-bottom: 0;
}

.resize-quality-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-brand);
}

.resize-quality-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--rt-border);
  outline: none;
  cursor: pointer;
}

.resize-quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rt-brand);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(255, 77, 43, 0.35);
}

.resize-quality-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rt-brand);
  cursor: pointer;
  border: 3px solid #fff;
}

.resize-quality-block--disabled {
  opacity: 0.55;
  pointer-events: none;
}

.resize-quality-block--disabled .resize-quality-slider {
  opacity: 0.5;
}

.resize-quality-hint {
  font-size: 11px;
  color: var(--rt-soft);
  margin: 4px 0 0;
  line-height: 1.35;
}

/* ── Multi-file queue ── */
.resize-queue-section {
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius);
  background: #fff;
  overflow: hidden;
}

.resize-queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-warm, #faf8f2);
  border-bottom: 1px solid var(--rt-border);
}

.resize-queue-toolbar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--rt-mid);
}

.resize-queue-add {
  font-size: 12px;
  font-weight: 700;
  color: var(--rt-brand);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
}

.resize-queue-add:hover {
  background: var(--rt-brand-bg);
}

.resize-queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
}

.resize-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background 0.12s;
}

.resize-queue-item:last-child {
  border-bottom: none;
}

.resize-queue-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

.resize-queue-item.is-active {
  background: var(--rt-brand-bg);
}

.resize-queue-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--rt-border);
}

.resize-queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resize-queue-meta {
  flex: 1;
  min-width: 0;
}

.resize-queue-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #0a0a0a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resize-queue-sub {
  font-size: 10px;
  color: var(--rt-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.resize-queue-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--rt-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resize-queue-remove:hover {
  background: rgba(255, 77, 43, 0.12);
  color: var(--rt-brand);
}

/* ── Actions ── */
.resize-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resize-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--rt-brand);
  color: #fff;
  border: none;
  border-radius: var(--rt-radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.resize-download-btn:hover:not(:disabled) {
  filter: brightness(0.95);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 77, 43, 0.28);
}

.resize-download-btn:disabled {
  background: var(--rt-border);
  color: var(--rt-soft);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.resize-reset-link {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: inherit;
}

.resize-reset-link:hover {
  color: var(--rt-brand);
}

/* ── Preview column ── */
.resize-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resize-preview-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--rt-mid);
}

.resize-view-toggle {
  display: flex;
  gap: 4px;
}

.resize-view-btn {
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--rt-border);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  color: var(--rt-soft);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.resize-view-btn.active {
  background: #fff;
  color: var(--ink, #0a0a0a);
  border-color: var(--ink, #0a0a0a);
}

.resize-preview-stage {
  flex: 1;
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 220px;
  position: relative;
}

.resize-preview-empty {
  text-align: center;
  padding: 24px;
  color: var(--rt-soft);
}

.resize-preview-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.45;
}

.resize-preview-empty p {
  font-size: 13px;
  line-height: 1.45;
}

.resize-preview-img {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--rt-radius-sm);
}

.resize-stats-bar {
  background: #fff;
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.resize-stat {
  text-align: center;
}

.resize-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #0a0a0a);
}

.resize-stat-val--green {
  color: var(--rt-green);
}

.resize-stat-label {
  font-size: 10px;
  color: var(--rt-soft);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resize-status-line {
  font-size: 12px;
  text-align: center;
  color: var(--rt-soft);
  margin: 0;
}
