/* Song Snapper - Styles */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a26;
  --bg-hover: #242436;
  --accent-primary: #00d4ff;
  --accent-secondary: #00ffaa;
  --accent-glow: rgba(0, 212, 255, 0.25);
  --accent-glow-strong: rgba(0, 212, 255, 0.5);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --border-color: #2a2a40;
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

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

body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%), radial-gradient(ellipse at 70% 80%, rgba(0, 255, 170, 0.05) 0%, transparent 50%), radial-gradient(ellipse at 50% 50%, rgba(100, 100, 150, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.listen-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease-out 0.1s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.listen-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  background: radial-gradient(circle at center, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px rgba(0, 212, 255, 0.05);
}

.listen-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px var(--accent-glow-strong), inset 0 0 40px rgba(0, 212, 255, 0.1);
}

.listen-btn:active {
  transform: scale(0.98);
}

.listen-btn.listening {
  animation: pulse-glow 1.5s ease-in-out infinite;
  border-color: var(--accent-secondary);
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px rgba(0, 212, 255, 0.05);
  }

  50% {
    box-shadow: 0 0 60px var(--accent-glow-strong), inset 0 0 50px rgba(0, 212, 255, 0.15);
  }
}

.listen-icon {
  font-size: 3.5rem;
  position: relative;
}

.listen-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.listen-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent-secondary);
  animation: pulse-ring 1.5s ease-out infinite;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pulse-ring.delay {
  animation-delay: 0.75s;
}

@keyframes pulse-ring {
  0% {
    width: 20%;
    height: 20%;
    opacity: 1;
  }

  100% {
    width: 150%;
    height: 150%;
    opacity: 0;
  }
}

.detection-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--accent-primary);
  overflow: hidden;
  margin-bottom: 2rem;
  animation: slideUp 0.4s ease-out;
  box-shadow: 0 0 30px var(--accent-glow);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detection-header {
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detection-body {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
}

.detection-cover {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.detection-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detection-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.detection-artist {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.detection-album {
  color: var(--accent-secondary);
  font-size: 0.85rem;
}

.detection-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem;
}

.detection-progress {
  padding: 0 1.25rem 1.25rem;
}

.progress-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.progress-bar-container {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

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

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  flex: 0;
}

.section {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  animation: fadeIn 0.6s ease-out 0.3s both;
}

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

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.history-item.downloaded {
  border-left-color: var(--success);
}

.history-item.skipped {
  border-left-color: var(--warning);
  opacity: 0.7;
}

.history-item.failed {
  border-left-color: var(--error);
  opacity: 0.7;
}

.history-cover {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.history-cover-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-artist {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.history-album {
  font-size: 0.75rem;
  color: var(--accent-secondary);
  margin-top: 0.15rem;
}

.history-status {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.history-status.downloaded {
  color: var(--success);
}

.history-status.skipped {
  color: var(--warning);
}

.history-status.failed {
  color: var(--error);
}

.history-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.875rem 1.25rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  max-width: 350px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.info {
  border-color: var(--accent-primary);
}

.hidden {
  display: none !important;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

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

.config-error {
  text-align: center;
  padding: 50px;
  font-family: system-ui, sans-serif;
  color: var(--text-primary);
}

.config-error h2 {
  margin-bottom: 1rem;
  color: var(--accent-primary);
}

.config-error code {
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

@media (max-width: 768px) {
  .container {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  .listen-btn {
    width: 150px;
    height: 150px;
  }

  .listen-icon {
    font-size: 2.5rem;
  }

  .detection-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .detection-cover {
    width: 120px;
    height: 120px;
  }

  .detection-actions {
    flex-direction: column;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}