/**
 * SoundForge AI - Audio-Specific Styles
 * Waveform, meters, transport visual styles
 */

/* ===== WAVEFORM CANVAS ENHANCEMENTS ===== */
.waveform-canvas {
  image-rendering: pixelated;
  cursor: crosshair;
}

.waveform-canvas:active {
  cursor: grabbing;
}

/* Waveform states */
.waveform-container.has-audio {
  border-color: rgba(0, 212, 255, 0.2);
}

.waveform-container.is-playing .playhead-line {
  animation: playheadPulse 1s ease-in-out infinite;
}

@keyframes playheadPulse {
  0%, 100% { box-shadow: 0 0 8px var(--playhead-color); }
  50% { box-shadow: 0 0 16px var(--playhead-color), 0 0 24px rgba(255, 107, 107, 0.3); }
}

/* Selection styling */
.selection-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed var(--brand-secondary);
  border-radius: 2px;
  pointer-events: none;
}

/* Time ruler markers */
.time-marker {
  position: absolute;
  bottom: 100%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 2px 4px;
}

.time-marker.major {
  color: var(--text-secondary);
}

/* ===== SPECTRUM VISUALIZATION ===== */
.spectrum-canvas {
  image-rendering: auto;
}

/* Spectrum bar style (drawn on canvas) */
.spectrum-bar {
  fill: linear-gradient(to top, var(--brand-primary), var(--brand-secondary));
}

/* ===== LEVEL METERS ENHANCEMENTS ===== */
.meter-channel {
  min-width: 0;
}

.meter-bar {
  position: relative;
  background: linear-gradient(
    to right,
    var(--meter-green) 0%,
    var(--meter-green) 70%,
    var(--meter-yellow) 85%,
    var(--meter-red) 100%
  );
  background-size: 100% 100%;
}

.meter-fill {
  background: inherit;
  background-clip: padding-box;
}

.meter-peak-hold {
  animation: peakHold 1.5s ease-out forwards;
}

@keyframes peakHold {
  from { opacity: 1; }
  to { opacity: 0.3; }
}

/* Meter clip indication */
.meter-channel.clipping .meter-fill {
  background: var(--brand-accent) !important;
  animation: clipPulse 0.3s ease infinite;
}

@keyframes clipPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== TRANSPORT ENHANCEMENTS ===== */
.btn-play.isPlaying #iconPlay {
  display: none;
}

.btn-play:not(.isPlaying) #iconPause {
  display: none;
}

.btn-play.isPlaying #iconPause {
  display: block;
}

/* Transport state indicators */
.transport-section.recording {
  border-color: var(--brand-accent);
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.2);
}

.transport-section.recording .btn-play {
  background: linear-gradient(135deg, var(--brand-accent), #ff4444);
}

/* Progress buffer indicator */
.progress-buffer {
  position: absolute;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  width: 0%;
  pointer-events: none;
}

/* ===== AUDIO OPERATION STATES ===== */
.op-panel.loading {
  position: relative;
  pointer-events: none;
}

.op-panel.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 26, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background-image: radial-gradient(circle, var(--brand-primary) 10%, transparent 10%);
  background-size: 20px 20px;
  animation: loadingDots 1s linear infinite;
}

@keyframes loadingDots {
  from { background-position: 0 0; }
  to { background-position: 20px 20px; }
}

/* Operation success/error states */
.op-panel.success {
  border-left: 3px solid var(--brand-success);
}

.op-panel.error {
  border-left: 3px solid var(--brand-accent);
}

/* ===== VISUALIZATION PANEL ENHANCEMENTS ===== */
.viz-canvas {
  background: var(--bg-primary);
}

.viz-canvas.bars-mode {
  image-rendering: pixelated;
}

/* Viz tab content heights */
.viz-content[data-viz="spectrum"] .viz-canvas {
  height: 180px;
}

.viz-content[data-viz="bars"] .viz-canvas {
  height: 250px;
}

/* ===== DRAG AND DROP STYLES ===== */
.waveform-container.drag-over {
  border: 2px dashed var(--brand-primary);
  background: rgba(0, 212, 255, 0.05);
}

.waveform-container.drag-over::after {
  content: 'Drop audio file here';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--brand-primary);
  background: rgba(10, 10, 26, 0.8);
  pointer-events: none;
}

/* ===== FILE DROP ZONE ===== */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand-primary);
  background: rgba(0, 212, 255, 0.05);
}

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.drop-zone-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.drop-zone-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: var(--space-2);
}

/* ===== PARAMETER ANIMATION ===== */
.param-input:focus,
.param-select:focus {
  transform: scale(1.01);
}

/* Slider value animations */
.effect-slider + span,
.volume-slider + span {
  transition: color var(--transition-fast);
  min-width: 36px;
  display: inline-block;
  text-align: right;
}

/* ===== TOAST ANIMATIONS ===== */
.toast.closing {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ===== KEYBOARD SHORTCUT HINTS ===== */
[data-shortcut]::after {
  content: attr(data-shortcut);
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

[data-shortcut]:hover::after {
  opacity: 1;
}

/* ===== PRINT STYLES ===== */
@media print {
  .transport-section,
  .operations-panel,
  .viz-panel,
  .status-bar,
  .loading-overlay,
  .toast-container {
    display: none !important;
  }
  
  .waveform-section {
    break-inside: avoid;
    box-shadow: none;
    border: 2px solid #ccc;
  }
}

/* ===== RESPONSIVE FOR AUDIO COMPONENTS ===== */

/* Mobile Portrait (<640px) */
@media (max-width: 640px) {
  /* Waveform container adjustments */
  .waveform-container {
    min-height: 120px;
  }
  
  /* Time markers - smaller on mobile */
  .time-marker {
    font-size: 0.55rem;
    padding: 1px 3px;
  }
  
  /* Visualization canvas */
  .viz-canvas {
    height: 150px;
  }
  
  .viz-content[data-viz="spectrum"] .viz-canvas {
    height: 140px;
  }
  
  .viz-content[data-viz="bars"] .viz-canvas {
    height: 200px;
  }
  
  /* Spectrum canvas */
  .spectrum-canvas {
    height: 120px;
  }
  
  /* Meter enhancements */
  .meter-bar {
    height: 16px;
  }
  
  .meter-db {
    font-size: 0.65rem;
    min-width: 35px;
  }
  
  /* Drop zone */
  .drop-zone {
    padding: var(--space-5);
  }
  
  .drop-zone-icon {
    font-size: 2rem;
  }
  
  .drop-zone-text {
    font-size: 0.8rem;
  }
  
  .drop-zone-hint {
    font-size: 0.7rem;
  }
}

/* Very Small Screens (<380px) */
@media (max-width: 380px) {
  .viz-canvas {
    height: 120px;
  }
  
  .spectrum-canvas {
    height: 100px;
  }
  
  .drop-zone {
    padding: var(--space-4);
  }
}

/* Ultrawide Screens (>1440px) */
@media (min-width: 1440px) {
  .viz-canvas {
    height: 250px;
  }
  
  .viz-content[data-viz="bars"] .viz-canvas {
    height: 300px;
  }
  
  .spectrum-canvas {
    height: 180px;
  }
}
