/* style.css — Painting Value Study Tool */

/* ── Reset & Base ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  padding: 1rem;
}

/* ── Header ────────────────────────────────── */
header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f0f0f0;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ── Drop Zone ─────────────────────────────── */
#upload-section {
  max-width: 600px;
  margin: 1rem auto 0;
}

#drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  border: 2px dashed #555;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: #7c8aff;
  background: rgba(124, 138, 255, 0.08);
}

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

.drop-hint {
  font-size: 0.8rem;
  color: #666;
}

/* ── Tab Bar ──────────────────────────────── */
#tab-bar {
  display: flex;
  gap: 0.25rem;
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding: 0 0.25rem;
  border-bottom: 1px solid #2a2a45;
}

.tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  background: #252540;
  color: #ccc;
}

.tab-btn.active {
  background: #252540;
  color: #f0f0f0;
  border-bottom-color: #7c8aff;
}

/* ── Tool Views ────────────────────────────── */
.hidden {
  display: none !important;
}

#tool-views {
  max-width: 1100px;
  margin: 1rem auto 0;
}

.tool-view {
  /* shown by .hidden removal */
}

.canvas-pair {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.canvas-box {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.canvas-box h3 {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.canvas-box canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #111;
}

/* ── Controls ──────────────────────────────── */
.controls {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.control-label {
  font-size: 0.9rem;
  color: #aaa;
  min-width: 4rem;
}

#value-slider {
  flex: 1;
  max-width: 400px;
  accent-color: #7c8aff;
  height: 6px;
}

#value-label {
  color: #f0f0f0;
  font-size: 1.1rem;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  max-width: 400px;
  width: 100%;
  margin-left: 4.75rem;
  font-size: 0.7rem;
  color: #666;
}

/* ── Mode Radio Buttons ────────────────────── */
.mode-row {
  gap: 0.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: #252540;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.radio-label:hover {
  background: #303055;
}

.radio-label input[type="radio"] {
  accent-color: #7c8aff;
}

.radio-label:has(input:checked) {
  background: #7c8aff22;
  outline: 1px solid #7c8aff55;
}

/* ── Histogram ─────────────────────────────── */
.histogram-section {
  margin-top: 1.25rem;
  text-align: center;
}

.histogram-section h3 {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#histogram-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #111;
}

/* ── Sketch Section ───────────────────────── */
/* (sketch toggle styles removed — now uses tab bar) */

.sketch-canvas-box canvas,
.grid-canvas-box canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #111;
}

#edge-threshold {
  flex: 1;
  max-width: 400px;
  accent-color: #7c8aff;
  height: 6px;
}

#edge-threshold-label {
  color: #f0f0f0;
  font-size: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: #252540;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.checkbox-label:hover {
  background: #303055;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #7c8aff;
}

.checkbox-label:has(input:checked) {
  background: #7c8aff22;
  outline: 1px solid #7c8aff55;
}

/* ── Download ──────────────────────────────── */
.download-section {
  margin-top: 1rem;
  text-align: center;
}

.download-btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 8px;
  background: #7c8aff;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.download-btn:hover {
  background: #5e6ee0;
}

/* ── Responsive: Mobile ────────────────────── */
@media (max-width: 700px) {
  .canvas-pair {
    flex-direction: column;
  }

  header h1 {
    font-size: 1.3rem;
  }

  #value-slider {
    max-width: 100%;
  }

  .slider-ticks {
    display: none; /* too cramped on mobile */
  }
}
