/* Castly — shared layout for image upscaler / compressor pages */

:root {
  --it-bg: #f8fafc;
  --it-surface: #ffffff;
  --it-border: #e2e8f0;
  --it-ink: #0f172a;
  --it-muted: #64748b;
  --it-orange: #f1641e;
  --it-orange-deep: #ea580c;
}

[data-theme='dark'] {
  --it-bg: #0f1115;
  --it-surface: #171a20;
  --it-border: #2a3040;
  --it-ink: #f1f5f9;
  --it-muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.tools-app {
  --it-bg: var(--surface-subtle, #faf9f6);
  --it-surface: var(--surface, #ffffff);
  --it-border: var(--border, #e2e8f0);
  --it-ink: var(--ink, #0f172a);
  --it-muted: var(--ink-muted, #64748b);
}

html[data-theme='dark'] .tools-app {
  --it-bg: #0f1115;
  --it-surface: #171a20;
  --it-border: #2a3040;
  --it-ink: #f1f5f9;
  --it-muted: #94a3b8;
}

.it-root {
  max-width: 720px;
  margin: 0;
  padding: 0;
}

.it-card {
  background: var(--it-surface);
  border: 1px solid var(--it-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.it-card h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--it-muted);
}

.it-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--it-muted);
}

.it-file-btn {
  display: inline-block;
  background: linear-gradient(135deg, #ea580c, var(--it-orange));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  text-align: center;
}

.it-file-btn:hover {
  filter: brightness(1.05);
}

.it-file-name {
  margin-top: 10px;
  font-size: 12px;
  color: var(--it-muted);
  word-break: break-all;
}

.it-row {
  margin-top: 14px;
}

.it-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--it-ink);
}

.it-select,
.it-range-val {
  width: 100%;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--it-border);
  background: var(--it-surface);
  color: var(--it-ink);
  font-size: 14px;
}

input[type='range'].it-range {
  width: 100%;
  max-width: 320px;
  accent-color: var(--it-orange);
}

.it-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.it-btn--primary {
  background: linear-gradient(135deg, #ea580c, var(--it-orange));
  color: #fff;
}

.it-btn--primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.it-btn--primary:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  opacity: 1;
  cursor: not-allowed;
  filter: none;
}

html[data-theme='dark'] .it-btn--primary:disabled {
  background: #2a3040;
  color: #64748b;
}

.it-btn--secondary {
  background: var(--it-surface);
  color: var(--it-ink);
  border: 1px solid var(--it-border);
}

.it-btn--secondary:hover:not(:disabled) {
  border-color: var(--it-orange);
  color: var(--it-orange-deep);
}

.it-btn--secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.it-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.it-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--it-muted);
  min-height: 1.25em;
}

.it-meta {
  font-size: 12px;
  color: var(--it-muted);
  margin-top: 8px;
}

.it-preview {
  margin-top: 14px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--it-border);
  max-height: 280px;
  object-fit: contain;
  background: var(--it-bg);
}

.it-pick-canvas {
  display: block;
  margin-top: 14px;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--it-border);
  cursor: crosshair;
  background:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}

[data-theme='dark'] .it-pick-canvas {
  background:
    linear-gradient(45deg, #2a3040 25%, transparent 25%),
    linear-gradient(-45deg, #2a3040 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a3040 75%),
    linear-gradient(-45deg, transparent 75%, #2a3040 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}
