/* Comprimir / redimensionar imagem — client-side tool */

/* Kill theme list bullets / markers inside the tool */
.article .cimg-app ul,
.article .cimg-app ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article .cimg-list li::before {
  display: none !important;
  content: none !important;
}

.cimg-intro {
  margin-bottom: 12px;
  color: var(--dica-body);
}

.cimg-intro strong {
  color: var(--dica-ink);
}

.cimg-privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
  color: var(--dica-body);
  font-size: 0.92rem;
  line-height: 1.45;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

.cimg-privacy svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: var(--dica-action);
  max-width: none;
}

.cimg-privacy strong {
  color: var(--dica-ink);
}

.cimg-privacy-short {
  display: none;
}

.cimg-app {
  --cimg-accent: var(--dica-action, #2f5da8);
  --cimg-accent-hover: var(--dica-action-hover, #244a86);
  --cimg-accent-soft: var(--dica-action-soft, rgba(47, 93, 168, 0.12));
  --cimg-accent-border: var(--dica-action-border, rgba(47, 93, 168, 0.35));
  --cimg-good: #079455;
  --cimg-warn: #dc6803;
  --cimg-bad: #d92d20;
  box-shadow: 0 0 0 1px var(--dica-border), 0 12px 32px var(--dica-shadow);
  border-radius: 16px;
  margin-bottom: 28px;
  background: var(--dica-surface);
  color: var(--dica-body);
  overflow: hidden;
}

.cimg-app *,
.cimg-app *::before,
.cimg-app *::after {
  box-sizing: border-box;
}

.cimg-app p {
  margin: 0;
}

.cimg-app button,
.cimg-app input,
.cimg-app select {
  font: inherit;
  color: inherit;
}

/* ---------- toolbar ---------- */
.cimg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
}

.cimg-toolbar-spacer {
  flex: 1 1 auto;
  min-width: 4px;
}

.cimg-app .cimg-btn,
.cimg-app a.cimg-btn,
.cimg-app a.cimg-btn:link,
.cimg-app a.cimg-btn:visited {
  appearance: none;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface);
  color: var(--dica-ink) !important;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.cimg-app .cimg-btn:hover,
.cimg-app a.cimg-btn:hover {
  border-color: var(--cimg-accent-border);
  background: var(--cimg-accent-soft);
  color: var(--dica-ink) !important;
}

.cimg-app .cimg-btn:focus-visible {
  outline: none;
  border-color: var(--cimg-accent);
  box-shadow: 0 0 0 3px var(--cimg-accent-soft);
}

.cimg-app .cimg-btn-primary,
.cimg-app .cimg-btn-primary:hover {
  background: var(--cimg-accent);
  border-color: var(--cimg-accent);
  color: #fff !important;
}

.cimg-app .cimg-btn-primary:hover {
  background: var(--cimg-accent-hover);
  border-color: var(--cimg-accent-hover);
}

.cimg-app .cimg-btn:disabled {
  opacity: 1;
  background: var(--dica-surface-soft) !important;
  border-color: var(--dica-border) !important;
  color: var(--dica-muted) !important;
  cursor: not-allowed;
}

.cimg-app .cimg-btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ---------- shell ---------- */
.cimg-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 0;
  align-items: stretch;
  border-bottom: 1px solid var(--dica-border);
}

.cimg-main,
.cimg-side {
  min-width: 0;
  padding: 18px 18px 20px;
}

.cimg-main {
  border-right: 1px solid var(--dica-border);
  background: var(--dica-surface);
}

.cimg-side {
  background: var(--dica-surface-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cimg-section-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dica-ink);
  line-height: 1.25;
}

/* ---------- dropzone ---------- */
.cimg-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 22px 16px;
  border: 2px dashed var(--dica-border);
  border-radius: 14px;
  background: var(--dica-surface-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 16px;
}

.cimg-drop:hover,
.cimg-drop.is-dragover {
  border-color: var(--cimg-accent);
  background: var(--cimg-accent-soft);
  box-shadow: inset 0 0 0 1px var(--cimg-accent-border);
}

.cimg-drop:focus-visible {
  outline: none;
  border-color: var(--cimg-accent);
  box-shadow: 0 0 0 3px var(--cimg-accent-soft);
}

.cimg-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--dica-surface);
  border: 1px solid var(--dica-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cimg-drop-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--cimg-accent);
}

.cimg-drop-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--dica-ink);
}

.cimg-drop-hint {
  font-size: 0.8rem;
  color: var(--dica-muted);
  line-height: 1.4;
  max-width: 28rem;
}

.cimg-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- fields ---------- */
.cimg-fields {
  display: grid;
  gap: 14px;
}

.cimg-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cimg-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cimg-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dica-ink);
}

.cimg-value {
  font-size: 0.84rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--cimg-accent);
}

.cimg-hint {
  font-size: 0.78rem;
  color: var(--dica-muted);
  line-height: 1.35;
}

.cimg-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--dica-border);
  outline: none;
  cursor: pointer;
}

.cimg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cimg-accent);
  border: 3px solid var(--dica-surface);
  box-shadow: 0 0 0 1px var(--cimg-accent-border), 0 2px 6px var(--dica-shadow);
  cursor: pointer;
}

.cimg-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cimg-accent);
  border: 3px solid var(--dica-surface);
  box-shadow: 0 0 0 1px var(--cimg-accent-border);
  cursor: pointer;
}

.cimg-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cimg-input,
.cimg-select {
  width: 100%;
  border: 1px solid var(--dica-border);
  border-radius: 10px;
  background: var(--dica-surface);
  color: var(--dica-ink);
  padding: 10px 12px;
  line-height: 1.35;
}

.cimg-input:focus,
.cimg-select:focus {
  outline: none;
  border-color: var(--cimg-accent);
  box-shadow: 0 0 0 3px var(--cimg-accent-soft);
}

.cimg-input:disabled {
  background: var(--dica-surface-soft);
  color: var(--dica-muted);
  cursor: not-allowed;
}

.cimg-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--dica-border);
  border-radius: 10px;
  background: var(--dica-surface);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cimg-check:hover {
  border-color: var(--cimg-accent-border);
  background: var(--cimg-accent-soft);
}

.cimg-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--cimg-accent);
  margin: 2px 0 0;
  flex: none;
}

.cimg-check span {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--dica-ink);
  line-height: 1.35;
}

.cimg-check small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dica-muted);
  margin-top: 2px;
}

/* ---------- side cards ---------- */
.cimg-card {
  background: var(--dica-surface);
  border: 1px solid var(--dica-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 2px var(--dica-shadow);
}

.cimg-card-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--dica-ink);
  opacity: 0.78;
  margin-bottom: 10px;
}

.cimg-stats {
  display: grid;
  gap: 8px;
}

.cimg-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
}

.cimg-stat-label {
  color: var(--dica-muted);
  font-weight: 600;
}

.cimg-stat-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--dica-ink);
  text-align: right;
}

.cimg-stat-value.is-good {
  color: var(--cimg-good);
}

.cimg-stat-value.is-warn {
  color: var(--cimg-warn);
}

.cimg-stat-value.is-muted {
  color: var(--dica-muted);
  font-weight: 650;
}

.cimg-tips {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.cimg-tips li {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--dica-muted);
  padding-left: 14px;
  position: relative;
}

.cimg-tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cimg-accent);
  opacity: 0.7;
}

.cimg-status {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--dica-muted);
}

.cimg-status.is-ok {
  color: var(--cimg-good);
  font-weight: 700;
}

.cimg-status.is-error {
  color: var(--cimg-bad);
  font-weight: 700;
}

/* ---------- results list ---------- */
.cimg-list-wrap {
  padding: 14px 16px 18px;
  background: var(--dica-surface);
}

.cimg-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cimg-list-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--dica-ink);
}

.cimg-list-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dica-muted);
  font-variant-numeric: tabular-nums;
}

.cimg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cimg-list-empty {
  margin: 0;
  padding: 18px 14px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--dica-muted);
  font-style: italic;
  border: 1px dashed var(--dica-border);
  border-radius: 12px;
  background: var(--dica-surface-soft);
}

.cimg-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--dica-border);
  border-radius: 14px;
  background: var(--dica-surface);
  box-shadow: 0 1px 2px var(--dica-shadow);
}

.cimg-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px solid var(--dica-border);
  background:
    linear-gradient(45deg, #e8edf3 25%, transparent 25%),
    linear-gradient(-45deg, #e8edf3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8edf3 75%),
    linear-gradient(-45deg, transparent 75%, #e8edf3 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: #f8fafc;
  object-fit: contain;
  display: block;
}

.cimg-item-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.cimg-item-name {
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--dica-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cimg-item-meta {
  font-size: 0.78rem;
  color: var(--dica-muted);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.cimg-item-save {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cimg-item-save.is-good {
  color: var(--cimg-good);
}

.cimg-item-save.is-warn {
  color: var(--cimg-warn);
}

.cimg-item-save.is-muted {
  color: var(--dica-muted);
}

.cimg-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.cimg-item-status {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dica-muted);
}

.cimg-item.is-error {
  border-color: color-mix(in srgb, var(--cimg-bad) 35%, var(--dica-border));
  background: color-mix(in srgb, var(--cimg-bad) 4%, var(--dica-surface));
}

.cimg-item.is-processing .cimg-item-status {
  color: var(--cimg-accent);
}

/* ---------- toast ---------- */
.cimg-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  background: var(--dica-ink, #1e293b);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(90vw, 360px);
  text-align: center;
}

.cimg-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .cimg-shell {
    grid-template-columns: 1fr;
  }

  .cimg-main {
    border-right: 0;
    border-bottom: 1px solid var(--dica-border);
  }

  .cimg-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .cimg-item-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .cimg-item-actions .cimg-btn {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .cimg-privacy-full {
    display: none;
  }

  .cimg-privacy-short {
    display: inline;
  }

  .cimg-row-2 {
    grid-template-columns: 1fr;
  }

  .cimg-toolbar .cimg-btn {
    flex: 1 1 auto;
  }

  .cimg-main,
  .cimg-side {
    padding: 14px;
  }
}

/* dark theme tweaks */
html[data-theme="dark"] .cimg-thumb {
  background-color: #0f172a;
  background-image:
    linear-gradient(45deg, #1e293b 25%, transparent 25%),
    linear-gradient(-45deg, #1e293b 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1e293b 75%),
    linear-gradient(-45deg, transparent 75%, #1e293b 75%);
}
