@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Unbounded:wght@500;700&display=swap");

:root {
  --bg: #0b0b10;
  --panel: #15141c;
  --panel-2: #1f1d2a;
  --accent: #ffb703;
  --accent-2: #00d4ff;
  --text: #f5f5f7;
  --muted: #9a94b0;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 20% 20%, #1d1b28 0%, #0b0b10 55%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background: var(--accent);
  color: #1b0f00;
}

.bg-shape {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

.bg-shape.one {
  background: #ff0054;
  top: -120px;
  right: -60px;
  animation-delay: 0s;
}

.bg-shape.two {
  background: #0077ff;
  bottom: -140px;
  left: -40px;
  animation-delay: -10s;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.4rem 4vw 1.8rem;
  flex-wrap: wrap;
}

.hero-text {
  flex: 1;
  min-width: 280px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo svg {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(255, 183, 3, 0.3));
}

.logo h1 {
  font-family: "Unbounded", cursive;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-2);
  font-weight: 600;
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
}

.sub {
  color: var(--muted);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 260px;
}

.file-pill {
  background: linear-gradient(120deg, #232235, #171722);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.file-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.file-pill:hover::before {
  opacity: 0.1;
}

.file-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(255, 183, 3, 0.2);
}

.file-pill:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-pill input {
  display: none;
}

.file-pill svg,
.file-pill span {
  position: relative;
  z-index: 1;
}

.meta {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--muted);
  gap: 0.2rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.8rem;
  padding: 0 4vw 3rem;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1.6rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.player {
  grid-column: 1 / -1;
}

.editor {
  grid-column: 1 / -1;
}

.player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.btn:hover::before {
  transform: translateX(0);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #2c2940;
}

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

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

.btn svg {
  position: relative;
  z-index: 1;
}

.btn span {
  position: relative;
  z-index: 1;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), #ff7b00);
  color: #1b0f00;
  box-shadow: 0 4px 12px rgba(255, 183, 3, 0.3);
}

.btn.primary:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(255, 183, 3, 0.4);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.2s ease;
}

.control:hover {
  background: rgba(255, 255, 255, 0.08);
}

.control input[type="range"] {
  width: 120px;
  cursor: pointer;
}

.control input[type="number"] {
  width: 90px;
  background: #0b0b12;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.control input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

.control select {
  background: #0b0b12;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
}

.time-display {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', monospace;
}

.divider {
  color: var(--muted);
}

.wave-wrap {
  margin-top: 1.5rem;
  background: #0d0c14;
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

.loading-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(13, 12, 20, 0.95);
  border-radius: 16px;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.waveform {
  width: 100%;
  height: 180px;
  min-height: 180px;
}

.waveform .wavesurfer-region {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  overflow: visible;
  transition: opacity 0.2s ease;
}

.waveform .wavesurfer-region:hover {
  opacity: 0.9;
}

.waveform .wavesurfer-region .region-label {
  position: absolute;
  top: -18px;
  left: 6px;
  font-size: 0.7rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waveform .wavesurfer-region.vocal-region {
  border: 1px solid rgba(0, 212, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25) inset;
}

.waveform .wavesurfer-region.beat-marker {
  border-radius: 2px;
  border: none;
  background: rgba(255, 183, 3, 0.8) !important;
  box-shadow: 0 0 0 1px rgba(255, 183, 3, 0.6);
}

.wave-hint {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-foot {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.8rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-group input {
  flex: 1;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 183, 3, 0.6);
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.08), rgba(0, 212, 255, 0.06));
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 183, 3, 0.2);
}

.quick-add-btn {
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0 1rem;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-add-btn:hover:not(:disabled) {
  background: #2c2940;
  border-color: var(--accent);
}

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

.export-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
}

.count-badge {
  background: rgba(255, 183, 3, 0.2);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 28px;
  text-align: center;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lyrics-table {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.lyrics-table .table-body {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 40px 140px 140px 1fr;
  align-items: center;
  gap: 0.6rem;
}

.table-head {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.8rem;
}

.table-body {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  min-height: 200px;
}

.table-body::-webkit-scrollbar {
  width: 6px;
}

.table-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.table-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.table-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.table-row {
  background: #12111b;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease;
}

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

.table-row:hover {
  background: #1a1824;
  transform: translateX(4px);
}

.table-row input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0b12;
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s ease;
}

.table-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 183, 3, 0.1);
}

.table-row input[type="text"].lyric-text {
  border-color: rgba(0, 212, 255, 0.5);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 183, 3, 0.06));
}

.table-row input[type="text"].time-input {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.table-row .row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 0.2rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state svg {
  opacity: 0.3;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-size: 1.2rem;
}

.empty-state p {
  margin: 0;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: none;
}

.toast {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  pointer-events: auto;
  animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.info {
  border-left: 3px solid var(--accent-2);
}

.toast-icon {
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

.toast.loading .toast-icon {
  display: none;
}

.toast.loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast.loading .toast-icon {
  display: none;
}

.toast.loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Help Button */
.help-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), #ff7b00);
  border: none;
  color: #1b0f00;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255, 183, 3, 0.4);
  transition: all 0.3s ease;
  z-index: 100;
}

.help-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 183, 3, 0.5);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlide 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shortcuts-grid {
  display: grid;
  gap: 1rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.shortcut-item kbd {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Icon states */
.icon-play,
.icon-pause {
  transition: opacity 0.2s ease;
}

.btn.playing .icon-play {
  display: none;
}

.btn.playing .icon-pause {
  display: block;
}

@media (max-width: 1100px) {
  .player {
    grid-column: auto;
  }
  .table-head,
  .table-row {
    grid-template-columns: 32px 120px 120px 1fr;
  }
  .table-head span:last-child,
  .table-row .row-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-actions {
    width: 100%;
  }
  
  .controls {
    width: 100%;
  }
  
  .control {
    flex: 1;
    min-width: 140px;
  }
  
  .toast-container {
    left: 20px;
    right: 20px;
  }
  
  .toast {
    min-width: auto;
  }
  
  .help-btn {
    bottom: 16px;
    right: 16px;
  }
  
  .modal-content {
    margin: 1rem;
  }
}

@media (max-width: 500px) {
  .grid {
    padding: 0 3vw 2rem;
  }
  
  .card {
    padding: 1.2rem;
  }
  
  .logo {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .time-display {
    font-size: 0.95rem;
  }
  
  .export-section {
    flex-direction: column;
  }
  
  .export-section .btn {
    width: 100%;
    justify-content: center;
  }
}
