/* Txt2Clb application styles. */
:root {
  color-scheme: light;
  --background: #eef3f1;
  --surface: #ffffff;
  --text: #18221f;
  --muted: #60706b;
  --border: #d7e0dd;
  --accent: #087f67;
  --accent-dark: #05634f;
  --accent-soft: #dff4ee;
  --danger: #a33a32;
  --background-accent: #d8eee7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #171c1b;
  --background-accent: #203d36;
  --surface: #252d2b;
  --text: #edf4f1;
  --muted: #a6b5b0;
  --border: #3d4b47;
  --accent: #35c6a4;
  --accent-dark: #77e1c8;
  --accent-soft: #173e35;
  --danger: #ff8f84;
}

[data-theme="cyber"] {
  color-scheme: dark;
  --background: #05050a;
  --background-accent: #071f24;
  --surface: #0d0d1a;
  --text: #00f2ff;
  --muted: #75cbd0;
  --border: #00f2ff;
  --accent: #ff0055;
  --accent-dark: #ff4b87;
  --accent-soft: #2a0715;
  --danger: #ff527e;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--background-accent) 0, transparent 34rem),
    var(--background);
  transition: color 0.3s ease, background-color 0.3s ease;
}

button,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(900px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 6rem 0 2rem;
}

.top-nav {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

.nav-links {
  display: flex;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-btn {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.7rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-controls {
  position: relative;
  display: flex;
  flex: none;
  height: 34px;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
}

.theme-controls input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-controls label {
  position: relative;
  z-index: 2;
  width: 60px;
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 750;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
}

.theme-controls input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.theme-controls input:checked + label { color: #fff; }
[data-theme="cyber"] .theme-controls input:checked + label { color: #000; }

.glider {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 2px;
  width: 60px;
  height: calc(100% - 4px);
  border-radius: 4px;
  background: var(--accent);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="cyber"] .glider { box-shadow: 0 0 15px var(--border); }
#t-default:checked ~ .glider { transform: translateX(0); }
#t-dark:checked ~ .glider { transform: translateX(60px); }
#t-cyber:checked ~ .glider { transform: translateX(120px); }

.app-header {
  max-width: 650px;
  margin-bottom: 2rem;
}

.app-header h1 {
  margin: 0.15rem 0 0.5rem;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.app-header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.eyebrow,
.step {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card {
  margin-bottom: 1rem;
  padding: clamp(1rem, 4vw, 1.75rem);
  border: 1px solid rgba(215, 224, 221, 0.85);
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(28, 55, 47, 0.08);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
}

.camera-picker {
  display: grid;
  gap: 0.3rem;
  min-width: min(280px, 45%);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  color: var(--text);
  background: var(--surface);
}

select {
  padding: 0.65rem 2.2rem 0.65rem 0.75rem;
}

textarea {
  min-height: 12rem;
  padding: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(8, 127, 103, 0.24);
  outline-offset: 2px;
}

.preview {
  position: relative;
  display: grid;
  min-height: 260px;
  overflow: hidden;
  border-radius: 1rem;
  background: #12201c;
  place-items: center;
}

.preview video,
.preview canvas {
  display: block;
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
}

.preview canvas.is-editable {
  cursor: crosshair;
  touch-action: none;
}

.preview [hidden] {
  display: none;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  color: #afbeb9;
  background: linear-gradient(135deg, #152923, #0e1916);
  place-items: center;
}

.status {
  min-height: 1.4em;
  margin: 0.75rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.image-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--background);
}

.image-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.image-tool-description {
  display: grid;
  gap: 0.25rem;
}

.image-tool-description strong {
  font-size: 0.92rem;
}

.image-tool-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.image-tool-controls label {
  display: grid;
  gap: 0.25rem;
  min-width: 130px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.button.compact {
  min-height: 2.45rem;
  padding-block: 0.45rem;
}

.button.crop-active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.primary:not(:disabled):hover {
  background: var(--accent-dark);
}

.button.secondary {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.button.secondary:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.text-button {
  color: var(--muted);
  background: transparent;
}

.result-actions {
  margin-top: 0.75rem;
}

.progress {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

footer {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

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

@media (max-width: 600px) {
  .app-shell {
    width: min(100% - 1rem, 900px);
    padding-top: 5.5rem;
  }

  .top-nav {
    gap: 0.5rem;
    padding-inline: 8px;
  }

  .nav-links {
    gap: 5px;
  }

  .nav-btn {
    padding-inline: 7px;
  }

  .theme-controls label,
  .glider {
    width: 45px;
  }

  #t-dark:checked ~ .glider { transform: translateX(45px); }
  #t-cyber:checked ~ .glider { transform: translateX(90px); }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .camera-picker {
    min-width: 100%;
  }

  .preview {
    min-height: 220px;
  }

  .image-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .image-tool-controls {
    align-items: stretch;
  }

  .button {
    flex: 1 1 auto;
  }
}
