/* css/style.css — Dracula-inspired dark theme */

:root {
  --bg: #282a36;
  --bg-card: #333545;
  --bg-input: #44475a;
  --bg-hover: #4e516a;
  --text: #f8f8f2;
  --text-dim: #a0a4b8;
  --accent: #bd93f9;
  --accent-hover: #caa4ff;
  --green: #50fa7b;
  --pink: #ff79c6;
  --cyan: #8be9fd;
  --orange: #ffb86c;
  --red: #ff5555;
  --yellow: #f1fa8c;
  --border: #555770;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1e1f2b 0%, #282a36 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
  text-align: center;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* Container */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* Section labels */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* Presets */
.presets-section {
  margin-bottom: 1rem;
}

.presets-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding-bottom: 0.4rem;
}

.preset-btn {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.preset-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.preset-btn.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* Controls card */
.controls-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.75rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group-full {
  grid-column: 1 / -1;
}

.control-group label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
}

.conditional-controls {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Format section */
.format-section {
  margin-bottom: 0.75rem;
}

.format-section .presets-bar {
  margin-bottom: 0.5rem;
}

.format-section .controls-card {
  margin-bottom: 0;
}

/* Inputs */
select, input[type="number"] {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

select:focus, input[type="number"]:focus {
  border-color: var(--accent);
}

select {
  cursor: pointer;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  margin-top: 0.3rem;
}

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

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

/* Radio buttons */
.radio-group {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: var(--accent);
}

/* Frequency quick-preset buttons */
.freq-presets {
  display: flex;
  gap: 0.25rem;
}

.freq-preset-btn {
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.freq-preset-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text);
}

.freq-preset-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.checkbox-label-sm {
  font-size: 0.75rem;
}

.checkbox-label-sm input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Advanced settings */
.advanced-section {
  margin-bottom: 0.75rem;
}

.advanced-toggle {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cyan);
  padding: 0.5rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.advanced-toggle::before {
  content: '\25b6';
  font-size: 0.6rem;
  transition: transform 0.2s;
}

details[open] .advanced-toggle::before {
  transform: rotate(90deg);
}

.advanced-toggle::-webkit-details-marker {
  display: none;
}

details[open] .controls-card {
  margin-top: 0.5rem;
}

/* Visualization */
.viz-section {
  margin-bottom: 0.75rem;
}

.canvas-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  box-shadow: var(--shadow);
}

.canvas-wrapper canvas {
  width: 100%;
  display: block;
  border-radius: 4px;
  background: #1e1f2b;
}

#waveformCanvas {
  height: 150px;
}

#frequencyCanvas {
  height: 120px;
}

.canvas-label {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.stale-indicator {
  position: absolute;
  bottom: 0.5rem;
  right: 0.6rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--orange);
  opacity: 0.7;
  cursor: default;
}

.stale-indicator[hidden] {
  display: none;
}

/* Seed row: input + randomize button */
.seed-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

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

.btn-tiny {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-tiny:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* Output level row: slider + number input */
.level-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

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

.level-input {
  width: 70px !important;
  flex: 0 0 70px;
  text-align: center;
}

/* Preview quality note */
.preview-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
  font-style: italic;
}

/* Aliasing notice under action buttons */
.aliasing-section {
  margin-top: 0.4rem;
}

.aliasing-option {
  text-align: center;
  display: flex;
  justify-content: center;
  margin-bottom: 0.3rem;
}

.aliasing-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.aliasing-notice-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.aliasing-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 2px dashed;
  flex-shrink: 0;
}

.aliasing-line-preview {
  border-color: var(--orange);
}

.aliasing-line-download {
  border-color: var(--red);
}

.aliasing-line-combined {
  border-top: none;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    var(--red) 0px, var(--red) 4px,
    transparent 4px, transparent 6px,
    var(--orange) 6px, var(--orange) 10px,
    transparent 10px, transparent 12px
  );
}

/* Aliasing underlines on action buttons */
.btn.aliasing-underline-preview {
  border-bottom: 2px dashed var(--orange);
}

.btn.aliasing-underline-download {
  border-bottom: 2px dashed var(--red);
}

/* Disabled channel options */
select option:disabled {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Action buttons */
.actions-section {
  margin-bottom: 0.75rem;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.3rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-icon {
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--green);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
  background: #69ffaa;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* Progress bar */
.progress-section {
  margin-top: 0.8rem;
  text-align: center;
}

.progress-bar-track {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 4px;
  transition: width 0.1s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* File info */
.info-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.75rem;
}

.info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.78rem;
}

.info-item {
  display: flex;
  gap: 0.3rem;
}

.info-label {
  color: var(--text-dim);
}

.info-value {
  color: var(--cyan);
  font-weight: 500;
}

/* Estimate */
.estimate-section {
  text-align: center;
  font-size: 0.78rem;
  margin-bottom: 0.75rem;
}

.estimate-label {
  color: var(--text-dim);
}

.estimate-value {
  color: var(--cyan);
  font-weight: 500;
}

.size-warning {
  color: var(--orange);
  font-size: 0.72rem;
  display: block;
  margin-top: 0.2rem;
}

/* About / how-to section */
.about-section {
  max-width: 680px;
  margin: 2rem auto 0;
  padding: 0 1rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.about-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 0.25rem 0;
}

.about-section details[open] summary {
  margin-bottom: 0.75rem;
}

.about-section p {
  margin-bottom: 0.75rem;
}

.about-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}

.about-section ul {
  padding-left: 1.25rem;
  margin: 0;
}

.about-section li {
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 600px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 1.3rem;
  }

  .btn {
    flex: 1;
    justify-content: center;
  }
}
