/* ============================================
   SonicMaster AI - Global Styles
   ============================================ */

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a0e1a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Selection */
::selection { background: rgba(99, 102, 241, 0.3); color: #e2e8f0; }

/* ===== ANIMATIONS ===== */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.3), 0 0 20px rgba(99, 102, 241, 0.1); }
  50% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.5), 0 0 40px rgba(99, 102, 241, 0.2); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes waveform-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes progress-bar {
  0% { width: 0%; }
  100% { width: 100%; }
}

.animate-slide-up { animation: slide-up 0.5s ease-out forwards; }
.animate-fade-in { animation: fade-in 0.3s ease-out forwards; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-spin-slow { animation: spin-slow 2s linear infinite; }

/* ===== CARD STYLES ===== */
.sm-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sm-card:hover {
  border-color: #334155;
  background: #1a2236;
}

/* ===== PRESET CARD ===== */
.preset-card {
  background: #111827;
  border: 2px solid #1e293b;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.preset-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.preset-card:hover {
  border-color: #4f46e5;
  background: #1a2236;
  transform: translateY(-2px);
}

.preset-card:hover::before {
  opacity: 1;
}

.preset-card.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(79, 70, 229, 0.05));
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3), 0 0 40px rgba(99, 102, 241, 0.1), inset 0 1px 0 rgba(99, 102, 241, 0.2);
  animation: pulse-glow 2s ease-in-out infinite;
}

.preset-card.active::before {
  opacity: 1;
  background: linear-gradient(90deg, #6366f1, #818cf8, #6366f1);
  height: 3px;
}

/* ===== SLIDER STYLES ===== */
.sm-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  outline: none;
  transition: all 0.2s;
}

.sm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  border: 2px solid #818cf8;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
  transition: all 0.2s;
}

.sm-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
}

.sm-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  border: 2px solid #818cf8;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.sm-slider:focus {
  background: #253048;
}

/* Slider fill effect (using linear-gradient trick) */
.sm-slider.has-fill {
  background: linear-gradient(to right, #6366f1 var(--fill-percent, 50%), #1e293b var(--fill-percent, 50%));
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: #1e293b;
  border-radius: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.toggle-switch.active {
  background: #6366f1;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch.active::after {
  left: 25px;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed #334155;
  border-radius: 16px;
  transition: all 0.3s;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(26, 34, 54, 0.5));
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(79, 70, 229, 0.03));
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
}

.upload-area.drag-over {
  transform: scale(1.01);
}

/* ===== WAVEFORM ===== */
.waveform-container {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: background-color 0.4s ease, box-shadow 0.3s ease;
}

/* Smart click: outer container padding = clickable for silent track switch */
.waveform-clickable {
  cursor: pointer;
}

/* Smart click: inner waveform div = clickable for seek + play */
.waveform-inner {
  position: relative;
  z-index: 1;
  cursor: crosshair;
}

.waveform-container .playhead-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(99, 102, 241, 0.05);
  pointer-events: none;
  transition: width 0.05s linear;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s;
  border: 1px solid rgba(99, 102, 241, 0.3);
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
}

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

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
}

.btn-success:hover {
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

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

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== TOOLTIP ===== */
.tooltip {
  position: relative;
}

.tooltip .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 50;
  border: 1px solid #334155;
  transition: all 0.2s;
  pointer-events: none;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ===== STATUS INDICATOR ===== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: waveform-pulse 2s ease-in-out infinite;
}

/* ===== MODAL/LOADING ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #1e293b;
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: spin-slow 1s linear infinite;
}

/* ===== TRANSPORT BUTTONS ===== */
.transport-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0a0e1a;
  border: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}
.transport-btn:hover {
  color: white;
  border-color: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

.transport-btn-sm {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #0a0e1a;
  border: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.2s;
}
.transport-btn-sm:hover {
  color: white;
  border-color: #6366f1;
}

/* ===== A/B TOGGLE BUTTONS ===== */
.ab-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.25s;
  color: #64748b;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}
.ab-btn:hover:not(:disabled) {
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.08);
}
.ab-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ab-btn-active-orig {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #818cf8 !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}
.ab-btn-active-mast {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc !important;
  border-color: rgba(168, 85, 247, 0.3) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .preset-card { padding: 14px; }
  .sm-slider::-webkit-slider-thumb { width: 22px; height: 22px; }
}

/* ===== NAV TABS ===== */
.nav-tab {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-tab:hover {
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.1);
}

.nav-tab.active {
  color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
}

/* Section label */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #6366f1;
  margin-bottom: 12px;
}

.section-label::before {
  content: '';
  width: 3px;
  height: 14px;
  background: #6366f1;
  border-radius: 2px;
}
