/* =========================================================
   Altacore Audio — editor.css
   Audio editor page. Bright, clean, functional.
   ========================================================= */

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.top-links a { text-decoration: none; transition: color 0.15s var(--ease); }
.top-links a:hover { color: var(--ink); }

@media (max-width: 820px) {
  .top-links { display: none; }
  .menu-toggle { display: inline-flex; }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 57px);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 900px) {
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
  }
}

/* Upload card */
.upload-card {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 28px 20px 24px;
  text-align: center;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.upload-card.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.upload-icon svg { width: 24px; height: 24px; }

.upload-card h3 {
  font-size: 16px;
  margin-bottom: 14px;
}

.upload-hint {
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* File info row */
.file-row {
  background: var(--accent);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-row.is-visible { display: flex; }

.file-row .file-info { flex: 1; min-width: 0; }
.file-row .name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .meta {
  font-size: 12.5px;
  opacity: 0.85;
  margin-top: 2px;
}

.file-row button {
  background: none;
  border: none;
  padding: 4px;
  color: inherit;
  opacity: 0.85;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s var(--ease);
}
.file-row button:hover { opacity: 1; }

/* Expiry notice */
.upsell-row {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}

/* ---------- Main Area ---------- */

.main {
  padding: 28px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 640px) {
  .main { padding: 20px 16px 32px; }
}

/* Preview / Waveform */
.preview {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  padding: 24px 28px 22px;
}

.preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 18px;
}

.preview-file {
  color: var(--ink-soft);
  font-weight: 600;
}

.wave-svg {
  width: 100%;
  height: 140px;
  display: block;
}

.wave-noisy { stroke: var(--ink-faint); opacity: 0.45; transition: opacity 0.3s var(--ease); }
.wave-clean {
  stroke: var(--accent);
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-clean 4s ease-in-out infinite;
  transition: opacity 0.3s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .wave-clean { animation: none; stroke-dashoffset: 0; }
}

@keyframes draw-clean {
  0%   { stroke-dashoffset: 900; opacity: 0; }
  14%  { opacity: 1; }
  55%  { stroke-dashoffset: 0; opacity: 1; }
  85%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.preview.is-original .wave-noisy { opacity: 1; }
.preview.is-original .wave-clean { opacity: 0 !important; animation-play-state: paused; }

.preview-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 14px;
}

/* ---------- Transport ---------- */

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.play-btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.scrub-track {
  flex: 1;
  height: 5px;
  background: var(--track);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.scrub-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  pointer-events: none;
  transition: width 0.1s linear;
}

.scrub-handle {
  position: absolute;
  left: 0%; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.1s linear;
}

.time {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}
.time.end { text-align: right; }

/* ---------- Original / Enhanced Toggle ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
}

.toggle-row .label-dim {
  color: var(--ink-faint);
  font-weight: 500;
  transition: color 0.2s var(--ease);
}

.toggle-row.is-enhanced .label-dim { color: var(--ink-faint); font-weight: 500; }
.toggle-row.is-enhanced .label-active { color: var(--accent); }
.toggle-row:not(.is-enhanced) .label-active { color: var(--ink-faint); font-weight: 500; }
.toggle-row:not(.is-enhanced) .label-dim { color: var(--ink); font-weight: 600; }

.switch {
  width: 46px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--track);
  position: relative;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s var(--ease);
}

.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(20px); }

/* ---------- Settings Panel ---------- */

.panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px 28px 28px;
  box-shadow: var(--shadow-sm);
}

.control {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.control:first-child { border-top: none; padding-top: 0; }

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.control-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.control-value .num {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* Slider */
.slider-track {
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  position: relative;
  cursor: pointer;
  padding: 12px 0;
  margin: -12px 0;
  background-clip: content-box;
}

.slider-fill {
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  pointer-events: none;
}

.slider-handle {
  position: absolute;
  top: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2.5px solid var(--accent);
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: box-shadow 0.15s var(--ease);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 10px;
}

/* Option rows (normalize, format) */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.option-help {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.check-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.format-select {
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 32px 10px 14px;
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239AA5B4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}
.format-select:hover { border-color: var(--accent); }
.format-select:focus { border-color: var(--accent); outline: none; }

/* ---------- Status Box ---------- */

.status-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.status-box strong {
  font-size: 14px;
  font-weight: 600;
}

.status-box span {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* Status states */
.status-box.is-success {
  background: var(--success-soft);
  border-color: var(--success);
}
.status-box.is-success strong { color: var(--success); }

.status-box.is-error {
  background: var(--error-soft);
  border-color: var(--error);
}
.status-box.is-error strong { color: var(--error); }

.status-box.is-processing {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.status-box.is-processing strong { color: var(--accent); }

/* Pulse animation for processing state */
.status-box.is-processing::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  animation: pulse-dot 1.5s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .status-box.is-processing::before { animation: none; }
}

/* ---------- Action Buttons ---------- */

.action-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-enhance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  transition: all 0.2s var(--ease);
}

.btn-enhance:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-enhance:active:not(:disabled) { transform: translateY(0); }

.btn-enhance:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  background: var(--success);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
  transition: all 0.2s var(--ease);
}

.btn-download:hover {
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
  transform: translateY(-1px);
}

.btn-download.is-hidden { display: none; }

/* ---------- Disabled states ---------- */

.play-btn:disabled,
.switch:disabled,
.btn-enhance:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

@media (max-width: 620px) {
  .option-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .toggle-row { font-size: 14px; gap: 10px; }

  .panel { padding: 20px; }

  .main { gap: 16px; }
}
