@import url('https://fonts.googleapis.com/css2?family=Inter:wght@600&display=swap');

@font-face {
  font-family: 'Octin College';
  src: url('assets/fonts/Octin College Book.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Death Stranded';
  src: url('assets/fonts/Death_Stranded.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'JD LCD Rounded';
  src: url('assets/fonts/JD-LCD-Rounded.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ---------- Theme ---------- */

:root {
  --tape-color: #fce700;
}

/* ---------- Base Layout ---------- */

body, html {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: #e5e5e5;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.main-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 32px;
  padding: 40px 24px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  box-sizing: border-box;
}

.tape-wrapper {
  width: 340px;
  min-width: 340px;
  background-color: var(--tape-color);
  position: relative;
}

/* ---------- Barcode Canvas ---------- */

#barcode-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  height: 115px;
  width: 100%;
  max-width: 290px;
  overflow: hidden;
}

#barcode-container canvas {
  display: block;
  width: 100%;
  height: 115px;
  image-rendering: pixelated;
}

/* ---------- Control Panel ---------- */

.control-panel {
  width: 340px;
  min-width: 300px;
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  position: sticky;
  top: 40px;
}

.control-panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.3px;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-section label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-section textarea,
.control-section input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  color: #222;
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  resize: vertical;
}

.control-section textarea:focus,
.control-section input[type="text"]:focus {
  border-color: var(--tape-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tape-color) 25%, transparent);
}

.control-section textarea {
  min-height: 80px;
  line-height: 1.5;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-row input[type="text"] {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--tape-color);
  color: #111;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--tape-color) 90%, #000);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover {
  background: #e4e4e4;
}

.section-divider {
  height: 1px;
  background: #eee;
  margin: 0;
  border: none;
}

.export-actions {
  display: flex;
  gap: 8px;
}

.export-actions .btn {
  flex: 1;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.control-hint {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #666;
}

.control-hint.error {
  color: #b42318;
}

.external-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.external-link:hover {
  background: #f0f0f0;
  border-color: #cfcfcf;
}

.external-link:active {
  transform: scale(0.98);
}

.external-link:focus-visible {
  outline: 2px solid var(--tape-color);
  outline-offset: 2px;
}

/* ---------- Tape Color Picker ---------- */

.color-swatches {
  display: flex;
  gap: 8px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  outline: none;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: #111;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .main-layout {
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
  }

  .control-panel {
    position: static;
    width: 340px;
  }
}
