/* -------------------------------------------------------------
 * MidiFlow Premium Stylesheet
 * Futuristic Dark/Neon Theme with Glassmorphism
 * ------------------------------------------------------------- */

:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #121218;
  --bg-card: rgba(22, 22, 30, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  
  /* Neon Colors */
  --neon-cyan: #00f0ff;
  --neon-purple: #bd00ff;
  --neon-emerald: #00ff66;
  --neon-pink: #ff007f;
  
  --shadow-glow-cyan: 0 0 15px rgba(0, 240, 255, 0.4);
  --shadow-glow-purple: 0 0 15px rgba(189, 0, 255, 0.4);
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --header-height: 70px;
  --transition-speed: 0.25s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(189, 0, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 240, 255, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  gap: 1.25rem;
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color var(--transition-speed);
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* -------------------------------------------------------------
 * HEADER & UPLOAD
 * ------------------------------------------------------------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-glow-purple);
}
.logo-text h1, .logo-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}
.logo-text h1 span, .logo-title span {
  color: var(--neon-cyan);
}
.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

/* Upload Zone */
.upload-zone {
  flex: 1;
  max-width: 500px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  transition: all var(--transition-speed);
  background: rgba(255, 255, 255, 0.02);
}
.upload-zone:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
  background: rgba(0, 240, 255, 0.01);
}
.upload-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  width: 100%;
}
.upload-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: color var(--transition-speed);
}
.upload-zone:hover .upload-icon {
  color: var(--neon-cyan);
}
.upload-text {
  display: flex;
  flex-direction: column;
}
.upload-text .highlight {
  font-weight: 600;
  font-size: 0.9rem;
}
.upload-text .subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* File Info Header */
.file-info-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  animation: fadeIn var(--transition-speed) ease-in-out;
}
.file-info-header i {
  color: var(--neon-cyan);
  font-size: 1.4rem;
}
.file-info-header .details {
  display: flex;
  flex-direction: column;
}
.file-info-header .file-name {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info-header .file-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: color var(--transition-speed);
}
.btn-clear:hover {
  color: var(--neon-pink);
}

.hidden {
  display: none !important;
}

/* -------------------------------------------------------------
 * PLAYBACK CONTROLS PANEL
 * ------------------------------------------------------------- */
.controls-panel {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  flex-wrap: wrap;
}

.playback-btns {
  display: flex;
  gap: 0.75rem;
}

.control-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}
.control-btn:hover:not(:disabled) {
  background: var(--neon-cyan);
  color: #000;
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow-glow-cyan);
  transform: scale(1.05);
}
.control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.play-btn {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--neon-cyan);
}
.play-btn.playing {
  background: rgba(255, 0, 127, 0.15);
  border-color: rgba(255, 0, 127, 0.3);
  color: var(--neon-pink);
}
.play-btn.playing:hover:not(:disabled) {
  background: var(--neon-pink);
  color: white;
  border-color: var(--neon-pink);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

/* Progress Slider */
.progress-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 300px;
}
.time-display {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.slider-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  height: 6px;
  width: 100%;
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: white;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.8);
  border-radius: 50%;
  height: 16px;
  width: 16px;
  transition: transform 0.1s;
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}
input[type="range"]:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.progress-bar-fill {
  position: absolute;
  left: 0;
  top: calc(50% - 3px);
  height: 6px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  border-radius: 6px;
  z-index: 1;
  pointer-events: none;
  width: 0%;
}

/* Speed / Volume / Zoom */
.extra-controls {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.control-slider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.control-slider i {
  color: var(--text-muted);
  font-size: 0.9rem;
  width: 16px;
}
.slider-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.slider-input-group input[type="range"] {
  width: 80px;
}
.slider-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 35px;
  text-align: right;
}

/* -------------------------------------------------------------
 * MAIN LAYOUT GRID
 * ------------------------------------------------------------- */
.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  flex: 1;
}

@media (max-width: 992px) {
  .main-layout {
    display: flex;
    flex-direction: column;
  }
  .viewport-container {
    order: 1;
  }
  .sidebar {
    order: 2;
  }
}

/* -------------------------------------------------------------
 * SIDEBAR: TRACK MANAGER
 * ------------------------------------------------------------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 750px;
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}
.sidebar-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-header h2 i {
  color: var(--neon-purple);
}
.sidebar-actions {
  display: flex;
  gap: 0.5rem;
}
.text-btn {
  background: transparent;
  border: none;
  color: var(--neon-cyan);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-speed);
}
.text-btn:hover {
  opacity: 0.8;
}
.text-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tracks-list-container {
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
}

.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  list-style: none;
}

.track-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-speed);
}
.track-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.track-item.muted {
  opacity: 0.4;
}

.track-checkbox-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.track-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  justify-content: center;
}
.track-checkbox:checked {
  background-color: var(--track-color, var(--neon-cyan));
  border-color: var(--track-color, var(--neon-cyan));
}
.track-checkbox:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.65rem;
  color: #000;
}

.track-color-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px var(--track-color);
  background-color: var(--track-color);
}

.track-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.track-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.solo-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-speed);
}
.solo-btn:hover {
  color: white;
  border-color: white;
}
.solo-btn.active {
  background: rgba(189, 0, 255, 0.15);
  border-color: var(--neon-purple);
  color: var(--neon-purple);
  box-shadow: 0 0 8px rgba(189, 0, 255, 0.2);
}
.solo-btn.active-lowest {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  height: 100%;
}
.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}
.empty-state p {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* -------------------------------------------------------------
 * TAB PANES & VIEWPORT
 * ------------------------------------------------------------- */
.viewport-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0; /* Prevents flex children from stretching outside container */
}

.tabs-nav {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  margin: 0;
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}
.tab-btn.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.05);
}

.tabs-content {
  flex: none; /* Prevent shrinking and collapsing on Safari */
  position: relative;
  min-height: 610px;
}

.tab-pane {
  display: none;
  width: 100%;
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* -------------------------------------------------------------
 * TAB 1: SYNTHESIA CANVAS VIEW
 * ------------------------------------------------------------- */
.canvas-wrapper {
  position: relative;
  flex: 1 0 auto; /* Prevent Safari flex shrink collapse */
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  overflow: hidden;
}

.canvas-controls {
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.canvas-ctrl-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.canvas-ctrl-item input[type="range"] {
  width: 70px;
}
.canvas-ctrl-item select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-body);
}
.canvas-ctrl-item select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.canvas-ctrl-item select:focus {
  border-color: var(--neon-cyan);
}
.canvas-ctrl-item select option {
  background: #0f172a;
  color: var(--text-main);
}

.canvas-container {
  position: relative;
  flex: 1 0 auto; /* Prevent Safari flex shrink collapse */
  background: #020204;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  height: 550px;
  cursor: grab;
}

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

#pianoFallingNotesCanvas,
#guitarFallingNotesCanvas,
#violinFallingNotesCanvas,
#harpFallingNotesCanvas,
#kalimbaFallingNotesCanvas,
#windFallingNotesCanvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(100% - 90px);
  z-index: 1;
}

#pianoKeysCanvas,
#guitarKeysCanvas,
#violinKeysCanvas,
#harpKeysCanvas,
#kalimbaKeysCanvas,
#windKeysCanvas {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 90px;
  z-index: 2;
  border-top: 2px solid #1a1a24;
}

/* Wind note timeline canvas */
#windKeysCanvas {
  height: 80px;
}
@media (min-width: 1024px) {
  #windKeysCanvas {
    height: 110px;
  }
}


/* -------------------------------------------------------------
 * TAB 2: CHORDS VIEW
 * ------------------------------------------------------------- */
.chord-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 600px;
}

.chord-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.chord-selector-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chord-selector-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.chord-selector-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-speed);
}
.chord-selector-group select:focus {
  border-color: var(--neon-cyan);
}
.chord-selector-group select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-purple), rgba(189, 0, 255, 0.6));
  border: none;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(189, 0, 255, 0.2);
  transition: all var(--transition-speed);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-purple);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.chords-display-container {
  flex: 1;
  overflow-y: auto;
  max-height: 520px;
  padding-right: 4px;
}

/* Chords Grid Layout */
.chords-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 0.25rem;
}

@media (max-width: 768px) {
  .chords-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .chords-grid {
    grid-template-columns: 1fr;
  }
}

.measure-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  min-height: 80px;
  padding: 0.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-speed);
}
.measure-box:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.measure-box.active {
  background: rgba(0, 240, 255, 0.05);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.measure-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  position: absolute;
  left: 6px;
  top: 4px;
}

.chords-list {
  display: flex;
  width: 100%;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.chord-symbol {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
  letter-spacing: -0.2px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.measure-box.active .chord-symbol {
  color: white;
  text-shadow: 0 0 10px var(--neon-cyan);
}
.chord-diagram-canvas {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  margin-top: 6px;
}

.chord-rest {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.2);
}

/* -------------------------------------------------------------
 * GLOBAL LOADING OVERLAY
 * ------------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 6, 8, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
}
.loading-overlay p {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Footer style */
.app-footer-info {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* -------------------------------------------------------------
 * TRANSPOSITION WIDGET
 * ------------------------------------------------------------- */
.transpose-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.transpose-actions {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
}
.transpose-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}
.transpose-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--neon-cyan);
}
.transpose-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--neon-cyan);
  width: 30px;
  text-align: center;
}

/* -------------------------------------------------------------
 * HERO BANNER & SONG GALLERY
 * ------------------------------------------------------------- */
.hero-banner {
  text-align: center;
  padding: 2rem 1.5rem;
  background: radial-gradient(circle at center, rgba(189, 0, 255, 0.08) 0%, rgba(22, 22, 30, 0.7) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hero-banner h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(90deg, #fff, var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-banner p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 700px;
  margin: 0 auto;
}

.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title i {
  color: var(--neon-purple);
}

.empty-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-gallery i {
  font-size: 3rem;
  color: var(--text-muted);
  opacity: 0.2;
  margin-bottom: 1rem;
}
.empty-gallery h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.song-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border-color: rgba(255, 255, 255, 0.05);
  transition: all var(--transition-speed) ease-in-out;
}
.song-card:hover {
  transform: translateY(-4px);
  border-color: var(--neon-cyan);
  box-shadow: 0 12px 40px rgba(0, 240, 255, 0.08);
}
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(189, 0, 255, 0.1);
  border: 1px solid rgba(189, 0, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--neon-purple);
  text-shadow: var(--shadow-glow-purple);
}
.song-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-filename {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-meta-tags {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.song-meta-tags span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.song-chords-preview {
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-chords-preview strong {
  color: var(--neon-cyan);
}
.btn-card-action {
  margin-top: auto;
  padding: 0.6rem;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 8px;
  color: var(--neon-cyan);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: all var(--transition-speed);
}
.song-card:hover .btn-card-action {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: var(--shadow-glow-cyan);
}

/* -------------------------------------------------------------
 * VEXFLOW SHEET MUSIC ROW STYLING
 * ------------------------------------------------------------- */
.sheet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 0.25rem;
  width: 100%;
  box-sizing: border-box;
}

.sheet-measure-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.25rem 0.5rem 0.5rem 0.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all var(--transition-speed);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  page-break-inside: avoid;
  width: 100%;
  box-sizing: border-box;
}

.sheet-measure-box:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(0, 240, 255, 0.15) !important;
}

.sheet-measure-box.active {
  background: rgba(0, 240, 255, 0.04) !important;
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15) !important;
}

.sheet-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 780px;
  height: 0;
  padding-bottom: 28.2%; /* Aspect ratio 780 / 220 */
  box-sizing: border-box;
}

.sheet-canvas-wrapper canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* -------------------------------------------------------------
 * PRINT STYLESHEET
 * ------------------------------------------------------------- */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .app-container {
    padding: 0 !important;
    max-width: 100% !important;
    gap: 0 !important;
  }
  .app-header, 
  .controls-panel, 
  .sidebar, 
  .tabs-nav, 
  .canvas-wrapper,
  .canvas-controls,
  .chord-header-bar,
  .app-footer-info {
    display: none !important;
  }
  .viewport-container,
  .tabs-content,
  .tab-pane,
  .chord-view-wrapper,
  .chords-display-container {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  
  .chord-sheet-print-header {
    display: block !important;
    margin-bottom: 2rem;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
  }
  .print-title {
    font-size: 2rem;
    font-weight: 800;
    color: black !important;
  }
  .print-track {
    font-size: 1.2rem;
    font-weight: 600;
    color: #444 !important;
    margin-top: 0.25rem;
  }
  .print-meta {
    font-size: 0.9rem;
    color: #666 !important;
    margin-top: 0.25rem;
  }

  .chords-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 15px !important;
    page-break-inside: auto;
  }
  .measure-box {
    border: 1px solid #999 !important;
    background: transparent !important;
    min-height: 70px !important;
    page-break-inside: avoid;
    box-shadow: none !important;
  }
  .measure-num {
    color: #555 !important;
  }
  .chord-symbol {
    color: #000 !important;
    text-shadow: none !important;
    font-size: 1.4rem !important;
  }
  .chord-rest {
    color: #ccc !important;
  }
  .sheet-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .sheet-measure-box {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
    page-break-inside: avoid !important;
  }
  .sheet-measure-box .measure-num {
    color: #555 !important;
    font-size: 0.6rem !important;
  }
  .sheet-canvas-wrapper canvas {
    filter: invert(1); /* Invert sheet music back to black on white background! */
  }
  .song-description-seo {
    display: none !important;
  }
}

/* Responsive adjustments for mobile screen */
@media (max-width: 768px) {
  .app-header {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "logo lang"
      "action action";
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .logo-area {
    grid-area: logo;
    justify-content: flex-start;
  }

  .header-actions {
    display: contents !important;
  }

  .lang-selector {
    grid-area: lang;
    justify-self: end;
  }

  .file-info-header,
  .app-header .btn-primary {
    grid-area: action;
    width: 100%;
    box-sizing: border-box;
  }

  .app-header .btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem 1.2rem;
  }

  .file-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 8px;
  }
  .file-info-header i {
    font-size: 1.1rem;
    flex-shrink: 0;
  }
  .file-info-header .details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    text-align: left;
  }
  .file-info-header .file-name {
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 100% !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .file-info-header .file-details {
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 100% !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .canvas-container {
    height: 380px !important;
  }
  .tabs-content {
    min-height: 440px !important;
  }
  
  /* Playback controls responsive fix */
  .controls-panel {
    flex-direction: column;
    align-items: stretch !important;
    gap: 1rem !important;
    padding: 0.75rem !important;
  }
  .progress-container {
    min-width: 0 !important;
    width: 100% !important;
  }
  .extra-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
    align-items: stretch !important;
  }
  .transpose-control {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }
  .control-slider {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex: none !important;
    min-width: 0 !important;
  }
  .slider-input-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex: 1 !important;
    min-width: 0 !important;
    width: auto !important;
    justify-content: flex-end !important;
  }
  .slider-input-group input[type="range"] {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 240px !important;
  }
  .slider-val {
    min-width: 42px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 480px) {
  .slider-input-group input[type="range"] {
    max-width: none !important;
  }
}

/* Local Loader inside Canvas Container */
.local-loader {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 2, 4, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.local-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.local-loader p {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Video Recorder Button Styles */
.btn-record {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: not-allowed;
  transition: all var(--transition-speed) ease;
}
.btn-record:not(:disabled) {
  cursor: pointer !important;
}
.btn-record:not(:disabled):hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
  transform: scale(1.05);
}
.btn-record.recording {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: pulse-red-record 1.5s infinite;
}

@keyframes pulse-red-record {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
