/* ============================================
   Vibes — Apple Music Light Mode
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: #FFFFFF;
  color: #000000;
  min-height: 100vh;
  padding: 0 16px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* --- Layout Container --- */
.header,
.search-section,
.empty-state,
.song-section,
.vibe-section,
.loading-state,
.error-state {
  max-width: 900px;
  margin: 0 auto;
}

/* --- Header --- */
.header {
  padding: 48px 0 8px;
  text-align: center;
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header-icon {
  width: 32px;
  height: 32px;
  color: #FC3C44;
}

.header-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.header-subtitle {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 400;
  color: rgba(60, 60, 67, 0.6);
}

/* --- Search --- */
.search-section {
  padding: 24px 0 16px;
  position: relative;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: rgba(60, 60, 67, 0.3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 42px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  color: #000000;
  background: #F2F2F7;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  outline: none;
  transition: border-color 200ms ease, background 200ms ease;
}

.search-input::placeholder {
  color: rgba(60, 60, 67, 0.3);
}

.search-input:focus {
  border-color: rgba(0, 0, 0, 0.12);
  background: #E5E5EA;
}

.search-clear {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: rgba(60, 60, 67, 0.3);
  cursor: pointer;
  border-radius: 50%;
  transition: color 200ms ease;
}

.search-clear:hover {
  color: rgba(60, 60, 67, 0.6);
}

/* --- Search Results Dropdown --- */
.search-results {
  position: absolute;
  top: calc(24px + 44px + 6px);
  left: 0;
  right: 0;
  background: #F2F2F7;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 200ms ease;
}

.search-result-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.search-result-item + .search-result-item {
  border-top: 1px solid rgba(60, 60, 67, 0.12);
}

.search-result-art {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.search-result-track {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-artist {
  font-size: 13px;
  font-weight: 400;
  color: rgba(60, 60, 67, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Empty State --- */
.empty-state {
  padding: 80px 0;
  text-align: center;
}

.empty-icon {
  color: rgba(60, 60, 67, 0.3);
  margin-bottom: 16px;
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-subtitle {
  font-size: 15px;
  font-weight: 400;
  color: rgba(60, 60, 67, 0.6);
}

/* --- Song Card --- */
.song-section {
  padding: 8px 0 0;
}

.song-card {
  background: #F2F2F7;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 20px;
}

.song-card-inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.album-art {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.song-meta {
  min-width: 0;
  flex: 1;
  padding-top: 4px;
}

.track-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.artist-name {
  font-size: 16px;
  font-weight: 500;
  color: #FC3C44;
  margin-bottom: 2px;
}

.album-name {
  font-size: 14px;
  font-weight: 400;
  color: rgba(60, 60, 67, 0.6);
}

/* --- Player Container --- */
.player-container {
  margin-top: 16px;
}

.player-container iframe {
  width: 100%;
  height: 175px;
  border: none;
  border-radius: 10px;
}

/* --- Vibe Scroll (Apple Music lyrics style) --- */
.vibe-section {
  padding: 24px 0 48px;
}

.vibe-scroll {
  padding: 24px 0;
}

/* --- Vibe Line --- */
.vibe-line {
  padding: 12px 0;
  opacity: 0;
  transform: translateY(8px);
  animation: vibeIn 300ms ease forwards;
}

.vibe-lyric {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.3px;
  color: #000000;
  cursor: pointer;
  transition: color 200ms ease;
}

.vibe-line:hover .vibe-lyric {
  color: rgba(60, 60, 67, 0.8);
}

.vibe-translation {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(60, 60, 67, 0.6);
  margin-top: 6px;
  padding-left: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 300ms ease, opacity 200ms ease, margin 200ms ease;
}

.vibe-line.active .vibe-translation {
  max-height: 200px;
  opacity: 1;
  margin-top: 8px;
}

.vibe-line.active .vibe-lyric {
  color: #FC3C44;
}

/* Dimmed state — when any line is active, dim the others */
.vibe-scroll.has-active .vibe-line:not(.active) .vibe-lyric {
  color: rgba(60, 60, 67, 0.2);
}

/* --- Section Markers --- */
.vibe-line.section-marker {
  padding: 24px 0 8px;
}

.vibe-line.section-marker .vibe-lyric {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(60, 60, 67, 0.3);
  cursor: default;
}

/* --- The Bottom Line Summary Card --- */
.vibe-summary-card {
  margin-top: 32px;
  padding: 24px;
  background: #F2F2F7;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  opacity: 0;
  transform: translateY(8px);
  animation: vibeIn 400ms ease forwards;
}

.vibe-summary-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #FC3C44;
  margin-bottom: 10px;
}

.vibe-summary-text {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  color: #000000;
}

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

/* --- Loading State --- */
.loading-state {
  padding: 48px 0;
  text-align: center;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FC3C44;
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-text {
  font-size: 15px;
  font-weight: 500;
  color: rgba(60, 60, 67, 0.6);
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* --- Error State --- */
.error-state {
  padding: 32px 0;
  text-align: center;
}

.error-message {
  font-size: 15px;
  font-weight: 400;
  color: rgba(60, 60, 67, 0.6);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .header {
    padding: 32px 0 8px;
  }

  .header-title {
    font-size: 28px;
  }

  .song-card-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .album-art {
    width: 180px;
    height: 180px;
  }

  .vibe-lyric {
    font-size: 20px;
  }

  .vibe-translation {
    font-size: 15px;
  }

  .vibe-summary-text {
    font-size: 16px;
  }
}
