/* ============================================================
   Frequency Range Analyzer — Styles
   FrequencyDetector.com
   ============================================================ */

/* Record Controls */
.record-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  background: var(--color-surface);
}

.record-controls__row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn--record-a {
  border-color: #00e5ff;
  color: #00e5ff;
  min-width: 180px;
}

.btn--record-a:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.1);
}

.btn--record-b {
  border-color: #ff6b35;
  color: #ff6b35;
  min-width: 180px;
}

.btn--record-b:hover:not(:disabled) {
  background: rgba(255, 107, 53, 0.1);
}

.record-status {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.record-status--done {
  color: var(--color-primary);
}

.record-status--capturing {
  color: var(--color-secondary);
  animation: pulse-badge 1s ease infinite alternate;
}

/* Capture Progress */
.capture-progress {
  position: relative;
  height: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-xs);
}

.capture-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-sm);
  width: 0%;
  transition: width 0.1s linear;
}

.capture-progress__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text);
  z-index: 1;
}

/* ── Range Cards (Min / Max Hz) ────────────────────────── */
.range-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.range-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  background: var(--color-surface);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.range-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.range-card--min::before {
  background: linear-gradient(90deg, #00e5ff, #00bcd4);
}

.range-card--max::before {
  background: linear-gradient(90deg, #ff6b35, #ff9800);
}

.range-card__label {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.range-card__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 2px;
}

.range-card--min .range-card__value {
  color: #00e5ff;
}

.range-card--max .range-card__value {
  color: #ff6b35;
}

.range-card__unit {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.range-card__note {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-primary);
  margin-top: 4px;
  font-weight: 700;
}

/* ── Instrument Range Overlay Bars ─────────────────────── */
.instrument-overlay {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  background: var(--color-surface);
}

.instrument-bar {
  display: grid;
  grid-template-columns: 60px 1fr 110px;
  align-items: center;
  gap: var(--space-xs);
}

.instrument-bar__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
}

.instrument-bar__track {
  position: relative;
  height: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.instrument-bar__fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 9px;
  opacity: 0.35;
}

.instrument-bar__fill--piano {
  background: #e91e63;
  left: 0%;
  width: 100%;
}

.instrument-bar__fill--guitar {
  background: #ff9800;
  left: 15.4%;
  width: 25.9%;
}

.instrument-bar__fill--voice {
  background: #4caf50;
  left: 16.1%;
  width: 24.1%;
}

.instrument-bar__fill--violin {
  background: #9c27b0;
  left: 28.8%;
  width: 41.0%;
}

.instrument-bar__fill--bass {
  background: #2196f3;
  left: 5.0%;
  width: 11.0%;
}

.instrument-bar__detected {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  border-radius: 7px;
  background: var(--color-primary);
  opacity: 0.85;
  box-shadow: 0 0 6px rgba(0, 255, 65, 0.4);
  display: none;
}

.instrument-bar__range {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ── Energy Breakdown Bars ─────────────────────────────── */
.energy-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  background: var(--color-surface);
}

.energy-band {
  display: grid;
  grid-template-columns: 150px 1fr 42px;
  align-items: center;
  gap: var(--space-xs);
}

.energy-band__label {
  font-size: var(--fs-sm);
  color: var(--color-text);
}

.energy-band__label small {
  color: var(--color-text-muted);
  font-size: 10px;
}

.energy-band__track {
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.energy-band__fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.15s ease;
}

.energy-band__fill--sub-bass {
  background: linear-gradient(90deg, #7c4dff, #b388ff);
}

.energy-band__fill--bass {
  background: linear-gradient(90deg, #2196f3, #64b5f6);
}

.energy-band__fill--low-mid {
  background: linear-gradient(90deg, #4caf50, #81c784);
}

.energy-band__fill--mid {
  background: linear-gradient(90deg, #ffeb3b, #fff176);
}

.energy-band__fill--upper-mid {
  background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.energy-band__fill--treble {
  background: linear-gradient(90deg, #f44336, #ef9a9a);
}

.energy-band__pct {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-align: right;
  font-weight: 700;
}

/* ── Range Summary Card ────────────────────────────────── */
.range-summary-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  background: var(--color-surface);
  min-height: 70px;
}

.range-summary-card--active {
  border-color: var(--color-primary);
  background: rgba(0, 255, 65, 0.05);
}

.range-summary-card__icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.range-summary-card__content {
  flex: 1;
  min-width: 0;
}

.range-summary-card__title {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
}

.range-summary-card__desc {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Waterfall Canvas ──────────────────────────────────── */
.viz-canvas-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg);
}

.viz-canvas-wrap--tall {
  height: 220px;
}

.viz-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── A vs B Comparison Panel ───────────────────────────── */
.comparison-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}

.comparison-col {
  padding: var(--space-sm);
}

.comparison-col--a {
  border-right: 1px solid var(--color-border);
}

.comparison-col__header {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

.comparison-col--a .comparison-col__header {
  color: #00e5ff;
}

.comparison-col--b .comparison-col__header {
  color: #ff6b35;
}

.comparison-col__stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.comparison-col__label {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.comparison-col__value {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text);
  font-weight: 700;
}

.comparison-divider {
  width: 1px;
  background: var(--color-border);
}

/* ── History + Export ───────────────────────────────────── */
.history-wrap {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}

.history-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  color: var(--color-text);
}

.export-actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

/* ── Voice Type Classification Card ────────────────────── */
.voice-type-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  background: var(--color-surface);
  min-height: 70px;
}

.voice-type-card--active {
  border-color: #e040fb;
  background: rgba(224, 64, 251, 0.05);
}

.voice-type-card__icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.voice-type-card__content {
  flex: 1;
  min-width: 0;
}

.voice-type-card__title {
  font-weight: 600;
  color: #e040fb;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
}

.voice-type-card__desc {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Freeze Badge ─────────────────────────────────────── */
.freeze-badge {
  display: inline-block;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid #00e5ff;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
  animation: pulse-badge 1s ease infinite alternate;
}

/* ── File Upload Zone ─────────────────────────────────── */
.file-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  background: var(--color-surface);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-upload-zone--dragover {
  border-color: var(--color-primary);
  background: rgba(0, 255, 65, 0.05);
}

.file-upload-zone__droparea {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
  padding: var(--space-xs) 0;
}

.file-upload-zone__icon {
  font-size: 1.4rem;
}

.file-upload-zone__text {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.file-upload-zone__btn {
  cursor: pointer;
}

.file-input--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-upload-zone__info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  flex-wrap: wrap;
}

.file-upload-zone__filename {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text);
  font-weight: 600;
}

.file-status {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.file-status--processing {
  color: var(--color-warning);
}

.file-status--done {
  color: var(--color-primary);
}

/* File Progress Bar */
.file-progress-wrap {
  position: relative;
  height: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-xs);
}

.file-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c4dff, var(--color-primary));
  border-radius: var(--radius-sm);
  width: 0%;
  transition: width 0.2s linear;
}

.file-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text);
  z-index: 1;
}

/* File Results */
.file-results {
  margin-top: var(--space-sm);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  background: rgba(0, 255, 65, 0.04);
}

.file-results__title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

.file-results__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-xs);
}

.file-results__item {
  display: flex;
  flex-direction: column;
}

.file-results__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.file-results__value {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text);
  font-weight: 700;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .record-controls__row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn--record-a,
  .btn--record-b {
    min-width: auto;
    width: 100%;
  }

  .record-status {
    text-align: center;
  }

  .range-cards {
    grid-template-columns: 1fr;
  }

  .instrument-bar {
    grid-template-columns: 50px 1fr 90px;
  }

  .energy-band {
    grid-template-columns: 120px 1fr 38px;
  }

  .comparison-panel {
    grid-template-columns: 1fr;
  }

  .comparison-col--a {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .comparison-divider {
    display: none;
  }

  .range-summary-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .viz-canvas-wrap--tall {
    height: 160px;
  }
}
