/* css/style.css — Styling for QueryResponse */

:root {
  /* Light mode (default) */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --accent: #e94560;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --radius: 8px;
  --border: rgba(0, 0, 0, 0.12);
  --slider-track: rgba(0, 0, 0, 0.1);
  --qr-module: #000000;
  --qr-bg: #ffffff;
}

body.dark-mode {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #e94560;
  --text: #eeeeee;
  --text-dim: #999999;
  --border: rgba(255, 255, 255, 0.1);
  --slider-track: rgba(255, 255, 255, 0.1);
  --qr-module: #ffffff;
  --qr-bg: #1a1a2e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

header p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ── Theme Toggle ────────────────────────────────────────────────────── */

.theme-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  line-height: 1;
}

.private-toggle {
  right: 3.25rem;
}

/* ── Mode Toggle ─────────────────────────────────────────────────────── */

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 1rem;
}

.mode-toggle button {
  flex: 1;
  max-width: 160px;
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-toggle button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.mode-toggle button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.mode-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* ── Panels ──────────────────────────────────────────────────────────── */

.panel {
  display: none;
  flex: 1;
  padding: 1rem;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.panel.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ── Drop Zone ───────────────────────────────────────────────────────── */

.drop-zone {
  width: 100%;
  min-height: 150px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  padding: 1.5rem;
  text-align: center;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
}

.drop-zone .icon {
  font-size: 2.5rem;
  opacity: 0.7;
}

.drop-zone .label {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.drop-zone input[type="file"] {
  display: none;
}

/* ── File Info ────────────────────────────────────────────────────────── */

.file-info {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  display: none;
}

.file-info.visible {
  display: block;
}

.file-info .name {
  font-weight: 600;
  word-break: break-all;
}

.file-info .details {
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ── Settings ────────────────────────────────────────────────────────── */

.settings {
  width: 100%;
  display: none;
  gap: 0.75rem;
}

.settings.visible {
  display: flex;
  flex-wrap: wrap;
}

.settings label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex: 1;
  min-width: 120px;
}

.settings input, .settings select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.settings input[type="range"] {
  padding: 0;
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.settings input[type="range"]::-webkit-slider-track {
  width: 100%;
  height: 6px;
  background: var(--slider-track);
  border-radius: 3px;
  border: none;
}

.settings input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.settings input[type="range"]::-moz-range-track {
  background: var(--slider-track);
  border: none;
  border-radius: 3px;
  height: 6px;
}

.settings input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#fps-display {
  font-weight: 600;
  color: var(--accent);
  min-width: 2.5em;
}

#qr-size-display {
  font-weight: 600;
  color: var(--accent);
  min-width: 3em;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-stop {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-save {
  background: #27ae60;
  color: #fff;
}

/* ── QR Display ──────────────────────────────────────────────────────── */

.qr-area {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.qr-area.visible {
  display: flex;
}

.qr-area canvas {
  max-width: 100%;
  border: none;
  image-rendering: pixelated;
}

/* ── Camera / Receiver ───────────────────────────────────────────────── */

.camera-area {
  width: 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.camera-area video {
  width: 100%;
  display: block;
}

/* Overlay at bottom of camera for progress during scanning */
.camera-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  display: none;
  pointer-events: none;
}

.camera-overlay.visible {
  display: block;
}

.camera-overlay .progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.camera-overlay .progress-bar .fill {
  height: 100%;
  background: #27ae60;
  transition: width 0.3s ease;
  width: 0%;
}

.camera-overlay .overlay-text {
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.35rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ── Receive Progress Area (above camera) ────────────────────────────── */

.receive-progress-area {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
}

.receive-progress-area.visible {
  display: flex;
}

/* ── Status Text ─────────────────────────────────────────────────────── */

.status-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  min-height: 1.2em;
}

/* ── Receive Complete ────────────────────────────────────────────────── */

.receive-complete {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  width: 100%;
}

.receive-complete.visible {
  display: flex;
}

.receive-complete .checkmark {
  font-size: 3rem;
}

.receive-complete .file-name {
  font-weight: 600;
  font-size: 1.1rem;
  word-break: break-all;
}

/* ── Utility ─────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

@media (max-width: 480px) {
  header h1 { font-size: 1.1rem; }
  .panel { padding: 0.75rem; }
  .mode-toggle button { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
}
