/* style.css - Premium Glassmorphism Dark Theme optimized for Desktop & iPad */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #0f172a;
  --border-color: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1; /* Indigo */
  --accent-secondary: #a855f7; /* Purple */
  --accent-teal: #14b8a6; /* Teal */
  --accent-record: #ef4444; /* Red */
  
  --btn-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Master Header Layout */
header {
  background: linear-gradient(to right, #1e1b4b, #111827);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.brand-section h1 {
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(to right, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Control Panels */
.control-group {
  display: flex;
  align-items: center;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 40px; /* Touch friendly size */
}

.btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: var(--btn-shadow);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-record {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--accent-record);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-record:hover {
  background-color: var(--accent-record);
  color: white;
}

.btn-record.recording-active {
  background-color: var(--accent-record);
  color: white;
  animation: pulse 1.5s infinite;
}

/* Master Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
  cursor: pointer;
  padding: 0 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* Main Workspace */
.main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Track list and Timeline Editor */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  position: relative;
}

/* Top Ruler Container */
.ruler-container {
  height: 48px;
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background-color: #0f172a;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.ruler-spacer {
  width: 160px; /* Width of track control header panel */
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  background-color: #0c111d;
  position: sticky;
  left: 0;
  z-index: 11;
}

.timeline-canvas-wrapper {
  flex: 1;
  position: relative;
  min-width: max-content;
}

#timeline-ruler {
  display: block;
  width: 100%;
  height: 100%;
}

/* Workspace Track Layout Scrollbar list */
.tracks-container {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 100%;
}

/* Single Audio Track Row */
.track-row {
  display: flex;
  height: 120px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  flex-shrink: 0;
  transition: background-color 0.2s;
  width: 100%;
}

.track-row.selected-track {
  background-color: rgba(99, 102, 241, 0.05);
}

/* Track Control Left Side Header Panel */
.track-controls {
  width: 160px;
  border-right: 1px solid var(--border-color);
  background-color: #0c111d;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  user-select: none;
  position: sticky;
  left: 0;
  z-index: 8;
}

.track-title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.track-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.btn-delete-track {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.btn-delete-track:hover {
  color: var(--accent-record);
}

.track-mix-buttons {
  display: flex;
  gap: 6px;
}

.btn-mix-toggle {
  flex: 1;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 28px;
}

.btn-mix-toggle.mute-active {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-record);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-mix-toggle.solo-active {
  background-color: rgba(20, 184, 166, 0.2);
  color: var(--accent-teal);
  border-color: rgba(20, 184, 166, 0.4);
}

.track-slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-label {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.track-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-primary);
  outline: none;
}

.track-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  transition: transform 0.1s;
}

.track-slider::-webkit-slider-thumb:active {
  transform: scale(1.3);
}

/* Waveform Canvas right-side panel */
.track-waveform-wrapper {
  flex: 1;
  position: relative;
  min-width: max-content;
}

.track-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Sidebar sound effects panel */
.sidebar-panel {
  width: 320px;
  border-left: 1px solid var(--border-color);
  background-color: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-panel.collapsed {
  width: 0;
  border-left: none;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close-sidebar {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px 10px 36px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent-primary);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-tabs::-webkit-scrollbar {
  height: 3px;
}

.category-tab {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.category-tab.tab-active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border-color: transparent;
}

/* Sound list items cards */
.sound-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sound-card {
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}

.sound-card:hover {
  border-color: var(--accent-primary);
}

.sound-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.sound-info p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.sound-badge {
  display: inline-block;
  background-color: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.sound-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-sfx-play {
  background-color: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-sfx-play:hover {
  background-color: var(--accent-primary);
  color: white;
  transform: scale(1.05);
}

.sfx-import-dropdown-container {
  display: flex;
  gap: 4px;
  flex: 1;
}

.btn-sfx-import {
  flex: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 11px;
  padding: 6px 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
  text-align: center;
}

.btn-sfx-import:hover {
  background-color: var(--border-color);
}

/* Modals and Overlays */
.overlay-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay-modal.modal-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.overlay-modal.modal-open .modal-card {
  transform: scale(1);
}

.countdown-number {
  font-size: 96px;
  font-weight: 800;
  color: var(--accent-record);
  margin: 10px 0;
  text-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.progress-container {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  height: 12px;
  border-radius: 6px;
  margin: 20px 0;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  width: 0%;
  height: 100%;
  transition: width 0.1s linear;
}

/* Custom Context Menu */
.context-menu {
  position: fixed;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 6px 0;
  min-width: 160px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  display: none;
  backdrop-filter: blur(10px);
}

.context-menu-item {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.15s, color 0.15s;
}

.context-menu-item:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.context-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Pulsing Record Ring */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Sound Source Selector Tabs */
.sfx-source-tabs {
  display: flex;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
}

.sfx-source-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
}

.sfx-source-tab:hover {
  color: var(--text-primary);
}

.sfx-source-tab.active-source {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Translation notice banner */
.translation-notice {
  background-color: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--accent-teal);
  margin-bottom: 12px;
  line-height: 1.4;
  animation: fadeIn 0.3s ease-out;
}

/* Pixabay key settings panel */
.pixabay-key-settings {
  background-color: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sound Upload Area styling */
.sfx-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: rgba(15, 23, 42, 0.2);
  transition: all 0.2s;
  margin-bottom: 12px;
  user-select: none;
}

.sfx-upload-box:hover {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.05);
}

.epidemic-settings {
  margin-bottom: 12px;
}
