/* CSS Variables for theming */
:root {
  --color-bg: #fafafa;
  --color-bg-secondary: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-border: #e5e5e5;
  --color-border-hover: #d0d0d0;
  --color-accent: #0d9488;
  --color-accent-hover: #0f766e;
  --color-accent-light: #ccfbf1;
  --color-tag-bg: #f0fdfa;
  --color-tag-text: #0f766e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --color-bg: #0f0f0f;
  --color-bg-secondary: #1a1a1a;
  --color-text: #f5f5f5;
  --color-text-muted: #a3a3a3;
  --color-border: #2a2a2a;
  --color-border-hover: #3a3a3a;
  --color-accent: #2dd4bf;
  --color-accent-hover: #5eead4;
  --color-accent-light: #042f2e;
  --color-tag-bg: #042f2e;
  --color-tag-text: #5eead4;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--color-accent);
}

#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

#theme-toggle:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg);
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

/* Main Content */
main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  width: 100%;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.tagline {
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

.subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
  line-height: 1.6;
}

.subtitle a {
  color: var(--color-accent);
  text-decoration: none;
}

.subtitle a:hover {
  text-decoration: underline;
}

.vibe-note {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
  opacity: 0.7;
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-container {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

#search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

#search-input::placeholder {
  color: var(--color-text-muted);
}

#search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

#search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-height: 360px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

#search-results:empty {
  display: none;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.15s ease;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background: var(--color-accent-light);
}

.result-image {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-border);
}

.result-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

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

.result-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-artist {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-lastfm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.result-lastfm:hover {
  color: #d51007;
  background: rgba(213, 16, 7, 0.1);
}

/* Genre Display */
#genre-display {
  margin: 2rem auto;
  max-width: 560px;
}

.genre-result {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.genre-result-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.genre-result-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-border);
}

.genre-result-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

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

.genre-result h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.artist-name {
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.lastfm-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  transition: all 0.15s ease;
}

.lastfm-link:hover {
  color: #d51007;
  border-color: #d51007;
  background: rgba(213, 16, 7, 0.05);
}

.genres h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.genre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.genre-tag {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform 0.15s ease;
}

.genre-tag:hover {
  transform: scale(1.05);
}

.no-genre {
  color: var(--color-text-muted);
  font-style: italic;
}

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

/* Features Section */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--color-border);
}

.feature {
  text-align: center;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: var(--radius-md);
  margin-bottom: 0.875rem;
}

.feature h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.feature p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Footer */
footer {
  padding: 2rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-content p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.footer-content p:last-child {
  margin-bottom: 0;
}

.footer-content a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.footer-content a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .hero {
    padding: 2rem 0 1.5rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
  }

  .feature {
    display: flex;
    align-items: flex-start;
    text-align: left;
    gap: 1rem;
  }

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

  .feature h3,
  .feature p {
    margin-bottom: 0.25rem;
  }
}

/* Scrollbar styling for search results */
#search-results::-webkit-scrollbar {
  width: 8px;
}

#search-results::-webkit-scrollbar-track {
  background: transparent;
}

#search-results::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

#search-results::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}
