/* ==========================================================================
   Cyber-Tech Karaoke Theme - Produtiva Sementes
   ========================================================================== */

:root {
  --bg-dark: #060a12;
  --bg-card: rgba(11, 19, 43, 0.65);
  --border-neon: rgba(0, 229, 255, 0.25);
  --border-green: rgba(0, 230, 118, 0.25);
  
  --primary-cyan: #00E5FF;
  --primary-green: #00E676;
  --accent-gold: #FFD700;
  --accent-purple: #9d4edd;
  
  --text-main: #F0F6FC;
  --text-muted: rgba(240, 246, 252, 0.45);
  --text-active: #FFFFFF;
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
}

/* Background Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Chorus Glow Celebration Overlay */
.chorus-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0, 230, 118, 0.15), rgba(0, 229, 255, 0.1) 50%, transparent 80%);
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.chorus-glow.active {
  opacity: 1;
  animation: pulseGlow 2s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 0.9; }
}

/* Main Layout Container */
.app-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1.5rem 2rem;
  gap: 1.25rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* Glassmorphism Common Style */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-neon);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5),
              inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
}

/* Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border: 1px solid var(--border-green);
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
  transition: var(--transition-smooth);
}

.logo-wrapper:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 230, 118, 0.4);
}

.brand-logo {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.badge-tech {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-green);
  background: rgba(0, 230, 118, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--primary-green);
  box-shadow: 0 0 8px var(--primary-green);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.song-title {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #FFFFFF 30%, var(--primary-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-icon {
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-green), #00b0ff);
  color: #040914;
  padding: 0.7rem 1.4rem;
  box-shadow: 0 4px 20px rgba(0, 230, 118, 0.35);
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 230, 118, 0.5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-neon);
  padding: 0.65rem 1.2rem;
}

.btn-secondary:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--primary-cyan);
  color: #FFF;
  transform: translateY(-2px);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-neon);
  padding: 0.65rem;
  border-radius: 12px;
}

.btn-icon:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* Lyrics Display Container */
.lyrics-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 2rem;
}

.lyrics-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  scroll-behavior: smooth;
  gap: 2rem;
  padding: 35vh 1.5rem;
  position: relative;
}

/* Customized Tech Scrollbar */
.lyrics-viewport::-webkit-scrollbar {
  width: 8px;
}
.lyrics-viewport::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}
.lyrics-viewport::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-cyan), var(--primary-green));
  border-radius: 10px;
  box-shadow: 0 0 10px var(--primary-cyan);
}
.lyrics-viewport::-webkit-scrollbar-thumb:hover {
  background: var(--primary-green);
}

/* Welcome Overlay Layer */
.welcome-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 10, 18, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: center;
  cursor: pointer;
  border-radius: 20px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.welcome-overlay.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.play-pulse-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-green), var(--primary-cyan));
  color: #040914;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;
  box-shadow: 0 0 35px rgba(0, 230, 118, 0.5);
  animation: pulseCircle 2s infinite ease-in-out;
  transition: var(--transition-fast);
}

.welcome-overlay:hover .play-pulse-circle {
  transform: scale(1.12);
  box-shadow: 0 0 50px rgba(0, 229, 255, 0.8);
}

@keyframes pulseCircle {
  0% { box-shadow: 0 0 25px rgba(0, 230, 118, 0.4); }
  50% { box-shadow: 0 0 45px rgba(0, 229, 255, 0.8); }
  100% { box-shadow: 0 0 25px rgba(0, 230, 118, 0.4); }
}

.welcome-overlay h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #FFF;
}

.welcome-overlay p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Lyric Lines (Fixed height layout for 100% stable scrolling) */
.lyric-line {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  color: var(--text-muted);
  opacity: 0.35;
  filter: blur(1px);
  transform: scale(0.92);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.4s ease,
              filter 0.4s ease,
              color 0.4s ease;
  cursor: pointer;
  padding: 0.6rem 1.8rem;
  border-radius: 16px;
  max-width: 90%;
  word-wrap: break-word;
  transform-origin: center center;
}

.lyric-line:hover {
  opacity: 0.7;
  filter: blur(0);
}

/* Active Lyric Line (Uses transform scale instead of font-size to prevent layout shift) */
.lyric-line.active {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text-active);
  opacity: 1;
  filter: blur(0);
  transform: scale(1.22);
  text-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 45px rgba(0, 229, 255, 0.2);
}

/* Chorus Active Line Extra Glow */
.lyric-line.active.is-chorus {
  color: #FFF;
  transform: scale(1.3);
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.2), rgba(0, 229, 255, 0.2));
  border: 2px solid var(--primary-green);
  box-shadow: 0 0 55px rgba(0, 230, 118, 0.45);
  animation: chorusPulse 1.2s infinite alternate ease-in-out;
}

@keyframes chorusPulse {
  0% { text-shadow: 0 0 25px var(--primary-green); }
  100% { text-shadow: 0 0 45px var(--primary-cyan), 0 0 60px var(--primary-green); }
}

/* Word Level Highlight (Smooth Fill Effect) */
.lyric-word {
  display: inline-block;
  position: relative;
  margin: 0 4px;
  transition: transform 0.2s ease;
}

/* Highlighted Karaoke Words inside Active Line */
.lyric-line.active .lyric-word.passed {
  color: var(--primary-cyan);
  text-shadow: 0 0 20px var(--primary-cyan);
}

.lyric-line.active .lyric-word.current {
  color: var(--primary-green);
  transform: scale(1.12);
  text-shadow: 0 0 25px var(--primary-green), 0 0 40px #FFF;
  animation: wordJump 0.3s ease-out;
}

@keyframes wordJump {
  0% { transform: scale(1); }
  50% { transform: scale(1.25) translateY(-4px); }
  100% { transform: scale(1.12) translateY(0); }
}

/* Audio Controls Bar */
.controls-bar {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.75rem;
  gap: 0.75rem;
}

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.time-display {
  font-size: 0.85rem;
  font-weight: 600;
  font-mono: monospace;
  color: var(--text-muted);
  min-width: 45px;
}

.progress-bar-wrapper {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  overflow: visible;
  transition: height 0.2s ease;
}

.progress-bar-wrapper:hover {
  height: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-cyan), var(--primary-green));
  border-radius: 10px;
  box-shadow: 0 0 15px var(--primary-green);
  position: absolute;
  top: 0;
  left: 0;
}

.progress-bar-handle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFF;
  box-shadow: 0 0 15px var(--primary-cyan);
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.progress-bar-wrapper:hover .progress-bar-handle {
  transform: translate(-50%, -50%) scale(1);
}

.sync-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sync-tick {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 12px;
  background: rgba(0, 229, 255, 0.4);
  border-radius: 2px;
}

/* Lower Control Bar Main Grid */
.controls-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.track-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}

.track-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.track-status {
  font-size: 0.78rem;
  color: var(--primary-cyan);
  opacity: 0.8;
}

/* Playback Buttons */
.playback-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-control-sub {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-control-sub:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  transform: scale(1.08);
}

.btn-control-play {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-cyan));
  color: #040914;
  border: none;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 230, 118, 0.4);
  transition: var(--transition-fast);
}

.btn-control-play:hover {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.7);
}

/* Audio Options (Speed & Volume) */
.audio-options {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 200px;
  justify-content: flex-end;
}

.speed-selector {
  position: relative;
}

.btn-speed-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-neon);
  color: var(--primary-cyan);
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-speed-badge:hover {
  background: rgba(0, 229, 255, 0.15);
}

.speed-menu {
  position: absolute;
  bottom: 125%;
  right: 0;
  background: #0b132b;
  border: 1px solid var(--border-neon);
  border-radius: 12px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 10;
}

.speed-menu.show {
  display: flex;
}

.speed-option {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
}

.speed-option:hover, .speed-option.active {
  background: rgba(0, 229, 255, 0.2);
  color: #FFF;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-sub {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.btn-icon-sub:hover {
  color: var(--primary-cyan);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-cyan);
  cursor: pointer;
}

/* Modal Window for Timestamp Editor */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 9, 20, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: #0b132b;
  border: 1px solid var(--border-neon);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-cyan);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.btn-close:hover {
  color: #FFF;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.editor-help {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(0, 229, 255, 0.08);
  border-left: 3px solid var(--primary-cyan);
  padding: 0.75rem 1rem;
  border-radius: 6px;
}

.editor-live-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-timer {
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-green);
}

.timestamp-table-container {
  overflow-x: auto;
}

.timestamp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.timestamp-table th, .timestamp-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.timestamp-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-cyan);
}

.timestamp-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-neon);
  color: #FFF;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.95rem;
  width: 110px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsiveness */
@media (max-width: 900px) {
  .app-container {
    padding: 1rem;
  }
  .song-title {
    font-size: 1.2rem;
  }
  .lyric-line {
    font-size: 1.8rem;
  }
  .lyric-line.active {
    font-size: 2.3rem;
  }
  .lyric-line.active.is-chorus {
    font-size: 2.5rem;
  }
  .controls-main {
    flex-direction: column;
    gap: 1rem;
  }
  .track-details, .audio-options {
    min-width: auto;
    width: 100%;
    justify-content: center;
  }
}
