/* ============================================================
   TIFF → JPG Converter — style.css
   Standalone, no external dependencies.
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#t2j-app {
  --bg0: #120a06;
  --bg1: #17100a;
  --panel: #1c130c;
  --panel2: #241a12;
  --border: rgba(255, 214, 178, 0.14);
  --border2: rgba(255, 214, 178, 0.26);
  --text: #fdf3e9;
  --muted: #b39a86;
  --accent: #f59e0b;
  --accent2: #f97316;
  --accent3: #fb7185;
  --cyan: #22d3ee;
  --green: #34d399;
  --danger: #fb7185;
  --radius: 14px;
  --radius-sm: 9px;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(249, 115, 22, 0.16), transparent 60%),
    radial-gradient(900px 600px at -10% 115%, rgba(251, 113, 133, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================ Topbar ============================ */
.t2j-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 16, 10, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}

.t2j-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.t2j-logo {
  display: inline-flex;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 16px rgba(249, 115, 22, 0.45));
}
.t2j-brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.t2j-brand-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: 2px;
}
.t2j-brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.t2j-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================ Buttons ============================ */
.t2j-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}
.t2j-btn:active { transform: translateY(1px); }
.t2j-btn:disabled { opacity: .55; cursor: wait; }

.t2j-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #f97316 55%, #fb7185);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}
.t2j-btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(251, 113, 133, 0.45);
  transform: translateY(-1px);
}

.t2j-btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border2);
}
.t2j-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 214, 178, 0.4);
}

.t2j-btn-sm { padding: 8px 11px; font-size: 12px; border-radius: 8px; }

/* ============================ Workspace ============================ */
.t2j-workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ============================ Sidebar ============================ */
.t2j-sidebar {
  flex: 0 0 380px;
  width: 380px;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--border);
  background: rgba(23, 16, 10, 0.5);
}

.t2j-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.t2j-panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.t2j-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ============================ Dropzone ============================ */
.t2j-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  padding: 22px 16px;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.t2j-dropzone:hover, .t2j-dropzone.drag {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.08);
  color: var(--text);
}
.t2j-dropzone.drag { transform: scale(1.01); }
.t2j-dropzone svg { opacity: .8; }
.t2j-dz-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.t2j-dz-sub { margin: 0; font-size: 12px; }
.t2j-dz-meta { margin: 4px 0 0; font-size: 10.5px; opacity: .65; }
.t2j-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.t2j-source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}
.t2j-fileinfo {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t2j-fileinfo b { color: var(--text); font-weight: 600; }

/* ============================ Fields ============================ */
.t2j-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.t2j-hint { text-transform: none; font-weight: 500; opacity: .7; }

.t2j-size-grid {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  align-items: end;
  gap: 10px;
}
.t2j-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.t2j-field-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: -1px;
}
.t2j-field input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: #120d08;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.t2j-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.t2j-field input::placeholder { color: #6b5b4c; }
.t2j-field-block { gap: 7px; }

/* lock toggle */
.t2j-lock {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #120d08;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.t2j-lock .lock-open { display: block; }
.t2j-lock .lock-closed { display: none; }
.t2j-lock.locked { color: var(--accent); border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.t2j-lock.locked .lock-open { display: none; }
.t2j-lock.locked .lock-closed { display: block; }

/* ============================ Scale ============================ */
.t2j-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.t2j-scale button {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 0;
  cursor: pointer;
  transition: all .15s ease;
}
.t2j-scale button:hover { color: var(--text); border-color: var(--border2); }
.t2j-scale button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* ============================ Quality ============================ */
.t2j-quality-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.t2j-quality-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.t2j-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
.t2j-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p, 92%), rgba(255, 255, 255, 0.14) var(--p, 92%));
}
.t2j-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  margin-top: -6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.t2j-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p, 92%), rgba(255, 255, 255, 0.14) var(--p, 92%));
}
.t2j-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.t2j-quality-ends {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: -6px;
}

/* ============================ Background ============================ */
.t2j-bg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.t2j-color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.t2j-color-picker input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 26px;
  height: 26px;
  cursor: pointer;
}
.t2j-color-well {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.t2j-color-check { display: none; color: #111; font-size: 12px; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6); }
.t2j-swatches { display: flex; gap: 7px; }
.t2j-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.t2j-swatch:hover { transform: scale(1.15); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }

/* ============================ Preview ============================ */
.t2j-preview {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.t2j-preview-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 16, 10, 0.55);
}
.t2j-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.t2j-zoom-group button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.t2j-zoom-group button:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--border2); }
.t2j-zoom-group .t2j-zoom-text { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.t2j-zoom-group .t2j-zoom-text:hover { color: var(--text); }
.t2j-zoom-pct {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.t2j-preview-actions { display: flex; align-items: center; gap: 9px; }

/* Stage */
.t2j-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  position: relative;
  padding: 44px;
  background-color: #15100b;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.t2j-stage canvas {
  flex: 0 0 auto;
  margin: auto;
  image-rendering: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
}

/* Empty state */
.t2j-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
  padding: 24px;
}
.t2j-empty.hidden { display: none; }
.t2j-empty-icon { opacity: .9; }
.t2j-empty h3 { margin: 0; font-size: 18px; font-weight: 700; }
.t2j-empty p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.t2j-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  padding: 1px 6px;
  border-radius: 5px;
}
.t2j-empty .t2j-btn { pointer-events: auto; margin-top: 6px; }

/* Status bar */
.t2j-preview-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  border-top: 1px solid var(--border);
  background: rgba(23, 16, 10, 0.6);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.t2j-preview-status .t2j-spacer { flex: 1 1 auto; }
#t2j-output-info { color: var(--text); font-weight: 600; }
#t2j-output-info .val { color: var(--accent); }

/* ============================ Toast ============================ */
.t2j-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: #2a1d12;
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 100;
  max-width: min(90vw, 460px);
}
.t2j-toast.show { opacity: 1; transform: translate(-50%, 0); }
.t2j-toast.success { border-color: rgba(52, 211, 153, 0.5); }
.t2j-toast.success::before { content: "✓ "; color: var(--green); }
.t2j-toast.error { border-color: rgba(251, 113, 133, 0.5); }
.t2j-toast.error::before { content: "✕ "; color: var(--danger); }

/* ============================ Scrollbars ============================ */
.t2j-sidebar::-webkit-scrollbar,
.t2j-stage::-webkit-scrollbar { width: 11px; height: 11px; }
.t2j-sidebar::-webkit-scrollbar-thumb,
.t2j-stage::-webkit-scrollbar-thumb {
  background: rgba(255, 214, 178, 0.2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.t2j-sidebar::-webkit-scrollbar-thumb:hover,
.t2j-stage::-webkit-scrollbar-thumb:hover { background: rgba(255, 214, 178, 0.36); background-clip: padding-box; }
.t2j-sidebar::-webkit-scrollbar-corner { background: transparent; }

/* ============================ Responsive ============================ */
@media (max-width: 900px) {
  .t2j-workspace { flex-direction: column; }
  .t2j-sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: 46vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .t2j-preview { min-height: 54vh; }
  .t2j-stage { padding: 24px; }
}

@media (max-width: 620px) {
  .t2j-brand-text p { display: none; }
  .t2j-topbar { padding: 10px 14px; }
  .t2j-topbar-actions .t2j-btn-ghost { display: none; }
  .t2j-preview-actions .t2j-btn-ghost { display: none; }
  .t2j-sidebar { padding: 12px; }
  .t2j-stage { padding: 16px; }
}
