/* Audio Editor Styles */

.editor-section {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.waveform-area {
  flex: 1;
  min-width: 0;
}

.waveform-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.zoom-level {
  font-size: 0.85rem;
  color: var(--gray-500);
  min-width: 30px;
  text-align: center;
}

/* Waveform Container */
.waveform-container {
  position: relative;
  background: var(--gray-900);
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  min-height: 200px;
}

.waveform-container canvas {
  display: block;
  width: 100%;
  height: 200px;
}

/* Selection Overlay */
.selection-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(79, 70, 229, 0.2);
  border-left: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
  pointer-events: none;
  display: none;
  z-index: 2;
}

/* Markers */
.marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 3;
  cursor: ew-resize;
}

.marker-start {
  background: #22c55e;
  left: 0;
  display: none;
}

.marker-end {
  background: #ef4444;
  left: 100%;
  display: none;
}

.marker-handle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 20px;
  background: inherit;
  border-radius: 0 0 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  cursor: ew-resize;
  user-select: none;
}

.marker-start .marker-handle {
  background: #22c55e;
}

.marker-end .marker-handle {
  background: #ef4444;
}

/* Playhead */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #facc15;
  left: 0;
  z-index: 4;
  pointer-events: none;
  display: none;
}

.playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -4px;
  width: 10px;
  height: 10px;
  background: #facc15;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Time Ticks */
.time-ticks {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: none;
  z-index: 1;
}

.time-tick {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-tick-line {
  width: 1px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
}

.time-tick-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  transform: translateX(-50%);
}

/* Waveform Info */
.waveform-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--gray-500);
}

#currentTimeDisplay {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

/* Controls Container */
.controls-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.controls-container .download-section {
  grid-column: 1 / -1;
}

.control-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
}

.control-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.control-group {
  margin-bottom: 12px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: block;
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.control-group:has(.control-label):has(.select-input) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group:has(.control-label):has(.select-input) .control-label {
  margin-bottom: 0;
  white-space: nowrap;
}

/* Transport Controls */
.transport-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.transport-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--gray-600);
}

.transport-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

.transport-btn-main {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.transport-btn-main:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.transport-btn-main.active {
  background: #ef4444;
  border-color: #ef4444;
}

.transport-btn-main.active:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
}

.volume-slider {
  flex: 1;
}

.volume-value {
  font-size: 0.8rem;
  color: var(--gray-500);
  min-width: 35px;
  text-align: right;
}

/* Range Slider */
.range-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Time Inputs */
.time-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-input-group .control-label {
  margin-bottom: 0;
  min-width: auto;
  font-size: 0.8rem;
  white-space: nowrap;
}

.time-input-group .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 8px;
  font-size: 0.8rem;
}

.time-input {
  flex: 1;
  min-width: 150px;
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  text-align: center;
}

.time-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Selection Info */
.selection-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* Format Options */
.format-options {
  display: flex;
  gap: 8px;
}

.format-option {
  flex: 1;
}

.format-option input {
  display: none;
}

.format-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  gap: 2px;
}

.format-option input:checked + .format-btn {
  border-color: var(--primary);
  background: #eef2ff;
}

.format-icon {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
}

.format-desc {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.format-option input:checked + .format-btn .format-icon {
  color: var(--primary);
}

/* Select Input */
.select-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Shortcuts */
.shortcuts-section {
  padding: 12px 16px;
}

.shortcuts-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--gray-600);
}

.shortcut-item kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.72rem;
  color: var(--gray-700);
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
  min-width: 24px;
  text-align: center;
}

/* Download Section */
.download-section {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.download-section .btn {
  flex: 1;
  min-width: 120px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  box-shadow: var(--shadow-lg);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

/* Info Section */
.info-section,
.links-section {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.info-section h2,
.links-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-item {
  padding: 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.info-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.info-item p {
  font-size: 0.88rem;
  color: var(--gray-600);
  line-height: 1.7;
}

.step-item {
  position: relative;
  text-align: center;
  padding-top: 24px;
}

.step-number {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.step-item h3 {
  color: var(--primary);
}

/* Links Section */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.links-grid a {
  display: block;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.links-grid a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--gray-200);
}

footer p {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 8px;
}

footer p:last-child {
  margin-bottom: 0;
}

footer .copyright {
  font-size: 0.8rem;
}

footer .copyright a {
  color: var(--gray-500);
  text-decoration: none;
}

footer .copyright a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Hidden */
.hidden {
  display: none !important;
}

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

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .editor-section {
    padding: 16px;
  }

  .control-section {
    padding: 12px;
  }

  .waveform-container canvas {
    height: 140px;
  }

  .download-section {
    flex-direction: column;
  }

  .download-section .btn {
    width: 100%;
  }

  .format-options {
    flex-wrap: wrap;
  }

  .format-option {
    flex: 1 1 30%;
  }

  .time-input-group {
    flex-wrap: wrap;
  }

  .time-input-group .control-label {
    width: 100%;
  }

  .time-input {
    flex: 1 1 50%;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }
}
