/**
 * Resonate Player - Enhanced CSS (2025)
 * Modern music streaming interface with adaptive design
 * Optimized for performance and user experience across devices
 */

/* ===== CSS VARIABLES & RESET ===== */
:root {
  /* Color Palette */
  --bg: #000;
  --fg: #fff;
  --muted: #94a3b8;
  --accent: #c4c4dd;
  --accent-alt: #38bdf8;
  --highlight: #f472b6;
  --secondary: #fbbf24;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  /* UI Components */
  --card: #1e293b;
  --btn: #334155;
  --btn-hover: rgba(110, 231, 183, 0.08);
  --btn-active: #111;
  --neutral: #e2e8f0;

  /* Spacing & Sizing - Mobile First */
  --border-radius: 8px;
  --border-radius-large: 12px;
  --border-radius-small: 6px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-xxl: 24px;

  /* Shadows & Effects */
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Loader Properties */
  --loader-size: 24px;
  --loader-border-width: 2px;
  --loader-duration: 0.8s;

  /* Component Sizes - Mobile Optimized */
  --art-size-mobile: 220px;
  --art-size-tablet: 280px;
  --art-size-desktop: 320px; /* Further reduced for desktop to show full footer */
  --btn-size-mobile: 48px;
  --btn-size-tablet: 44px;
  --btn-size-desktop: 40px;
  --btn-large-mobile: 56px;
  --btn-large-tablet: 52px;
  --btn-large-desktop: 50px;
  --search-height-mobile: 48px;
  --search-height-tablet: 44px;
  --search-height-desktop: 40px;
  --progress-height: 8px;
  --progress-height-desktop: 6px;
}

/* ===== GLOBAL RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  overflow-y: auto; /* Allow vertical scrolling */
  -webkit-tap-highlight-color: transparent;
}

/* ===== LAYOUT SYSTEM ===== */
.app {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

.main-player-section {
  flex-shrink: 0;
  padding: var(--spacing-xl) 0;
}

.discovery-section {
  flex: 0 0 auto; /* Don't grow, size based on content */
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  min-height: 0;
}

/* ===== HEADER & NAVIGATION ===== */
header {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  padding: var(--spacing-md) 0;
}

/* ===== OFFLINE INDICATOR ===== */
.offline-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.offline-indicator.active {
  opacity: 1;
  visibility: visible;
}

.offline-indicator.hidden {
  opacity: 0;
  visibility: hidden;
}

.offline-icon {
  font-size: 14px;
}

.offline-text {
  white-space: nowrap;
}

/* ===== OFFLINE MODE STYLES ===== */

.offline-mode .app {
  border-left: 3px solid var(--error);
}

.offline-mode header {
  background: rgba(239, 68, 68, 0.05);
}

/* ===== TYPOGRAPHY HIERARCHY ===== */
/* Mobile-first approach: base styles for mobile, then scale up */
/* Consistent hierarchy: h1 > h2 > h3 */
h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--spacing-lg) var(--spacing-md);
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 var(--spacing-md) 0;
  text-align: center;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  margin: 0 0 var(--spacing-md) 0;
}

/* ===== PLAYER SECTION ===== */
.player-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.player-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 var(--spacing-md);
}

.art {
  width: var(--art-size-mobile);
  height: var(--art-size-mobile);
  max-width: 90vw;
  margin-bottom: var(--spacing-lg);
  border-radius: var(--border-radius-large);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-light);
}

.art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.current-track-info {
  width: 100%;
  text-align: center;
  padding: var(--spacing-xl) 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.creator {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.description {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
  max-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 4px 0 0 0;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== PROGRESS BAR ===== */
.progress-section {
  width: 100%;
  margin: 5% 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s ease;
  padding: 8px;
  border-radius: 8px;
  position: relative;
}

.progress-section:hover {
  background: rgba(110, 231, 183, 0.05);
  transform: scale(1.02);
}

.progress-section:active {
  background: rgba(110, 231, 183, 0.08);
  transform: scale(1.01);
}

.progress-section.dragging {
  background: rgba(110, 231, 183, 0.1);
  box-shadow: 0 0 20px rgba(110, 231, 183, 0.3);
}

.time-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.progress-bar {
  width: 100%;
  height: var(--progress-height);
  background: var(--card);
  border-radius: 4px;
  overflow: visible;
  cursor: pointer;
  position: relative;
  transition: height 0.2s;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: none;
}

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

.progress {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  will-change: width;
  transition: width 0.1s linear;
  position: relative;
}

.progress::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}

.current-time,
.total-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 11px;
  position: absolute;
  top: 50%;
  pointer-events: none;
  z-index: 2;
}

.current-time {
  left: 1px;
  padding: 2px 4px;
  border-radius: 3px;
}

.total-time {
  right: 1px;
  padding: 2px 4px;
  border-radius: 3px;
}

/* ===== CONTROLS ===== */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-lg);
  margin: var(--spacing-xxl) var(--spacing-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
}

button {
  height: var(--btn-size-mobile);
  border: none;
  border-radius: var(--border-radius-large);
  background: var(--btn);
  color: var(--fg);
  font-size: 18px;
  cursor: pointer;
  padding: 0 var(--spacing-md);
  transition: transform 0.1s, background-color 0.2s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* iOS touch target minimum */
}

/* Button states */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:active:not(:disabled) {
  transform: scale(0.95);
  border: none;
}

/* Specific control buttons */
.play-btn,
.play-btn-favorite {
  width: var(--btn-large-mobile);
  height: var(--btn-large-mobile);
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-weight: bold;
  font-size: 18px;
  min-width: 56px;
  min-height: 56px;
}

.prev-btn,
.next-btn {
  min-width: 80px;
  min-height: var(--btn-size-mobile);
}

.favorite-btn {
  background: var(--btn);
  color: var(--muted);
  font-size: 17px;
  width: 80px;
  height: var(--btn-size-mobile);
  padding: 0;
}

.favorite-btn.active {
  color: #ff6b6b;
}

.shuffle-favorites-btn {
  background: var(--btn);
  color: var(--fg);
  font-size: 18px;
  font-weight: bold;
  width: 80px;
  height: var(--btn-size-mobile);
  padding: 0;
  position: relative;
}

.shuffle-favorites-btn.active {
  color: var(--accent);
  background: var(--btn);
  outline: 2px solid var(--accent);
}

.shuffle-favorites-btn svg {
  width: 20px;
  height: 20px;
  font-weight: bold;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shuffle-favorites-btn.active svg {
  stroke: var(--accent);
}

/* Adaptive quality indicator */
.adaptive-quality-indicator {
  /*display: none;*/
  align-items: center;
  justify-content: center;
  background: var(--btn);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  height: 28px;
  min-width: 40px;
}

.adaptive-quality-indicator:hover {
  background: rgba(110, 231, 183, 0.1);
  color: var(--accent);
}

.adaptive-quality-indicator:active {
  transform: scale(0.95);
  background: var(--card);
}

/* Volume control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
}

.volume-icon {
  font-size: 16px;
  color: var(--accent);
  cursor: pointer;
  padding: 5px;
}

.volume-slider {
  width: 60px;
  height: 4px;
  background: var(--card);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  display: none;
}

.volume-slider::-webkit-slider-thumb,
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ===== CONTACT SECTION ===== */
.contact-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  gap: 10px;
  font-size: 13px;
}

.contact-section a {
  transition: transform 0.2s;
}

.contact-section a:not([style*="cursor: not-allowed"]) {
  cursor: pointer;
}

.contact-section a:hover {
  transform: scale(1.05);
}

.contact-section img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

/* ===== GENRES SECTION ===== */
.genre-section {
  margin: 6px 0;
  flex-shrink: 0;
  width: 100%;
  padding: 0 5px;
}

.genre-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

select {
  width: 100%;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
}

select:focus {
  outline: 2px solid var(--accent);
}

.genre-buttons-section {
  margin: 15px 0 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
  padding: 0 5px;
}

.genre-btn {
  flex: 0 0 auto;
  height: 30px;
  background: var(--btn);
  color: var(--muted);
  border: 1px solid rgba(136, 136, 136, 0.2);
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 8px;
}

.genre-btn:hover {
  background: rgba(110, 231, 183, 0.08);
  border-color: var(--accent);
  transform: translateY(-0.5px);
}

.genre-btn:active {
  transform: scale(0.96);
  background: var(--accent);
  color: #000;
}

.genre-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ===== FAVORITES SECTION ===== */
.favorites-section {
  flex-shrink: 0;
  padding: 0 5px;
  display: none;
  flex-direction: row-reverse;
}

.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.favorites-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.favorites-label:hover {
  color: var(--accent);
  background: rgba(110, 231, 183, 0.08);
}

.favorites-label.active {
  color: var(--accent);
  background: rgba(110, 231, 183, 0.1);
}

.favorites-icon {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.favorites-label.active .favorites-icon {
  transform: rotate(180deg);
}

.favorites-text {
  font-weight: 600;
}

.favorites-count {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}



.favorites-toggle:active:not(:disabled) {
  transform: scale(0.96);
  border: none;
}

.favorites-toggle.active {
  color: var(--accent);
  background: var(--btn);
  outline: 2px solid var(--accent);
}

.favorites-toggle.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed !important;
}

#play-all-favorites-btn {
  color: var(--accent);
  display: none;
}

.favorites-list {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-top: 6px;
  display: none;
  background: var(--card);
  height: auto; /* Dynamic height, no scroll */
}

.favorites-list.active {
  display: block;
}

.favorite-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: background-color 0.2s;
  gap: 8px;
}

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

.favorite-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.favorite-item:active {
  background: #111;
}

.favorite-item.now-playing {
  background: rgba(110, 231, 183, 0.1);
  border-left: 3px solid var(--accent);
}

.favorite-item.now-playing .favorite-title {
  color: var(--accent);
  font-weight: 700;
}

.favorite-item.now-playing {
  background: rgba(110, 231, 183, 0.1);
  border-left: 3px solid var(--accent);
}

.favorite-info {
  flex: 1;
  min-width: 0;
  text-align: left;
  width: 100%;
}

.favorite-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
}

.favorite-creator {
  color: var(--muted);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
}

.favorite-actions {
  display: flex;
  gap: 5px;
  align-items: flex-start;
}

.favorite-actions .button {
  height: auto;
  padding: 4px 8px;
  font-size: 14px;
  min-width: 32px;
}

.favorite-play {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 10px;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 5px;
  font-weight: bold;
  height: auto;
}

.favorite-remove {
  background: transparent;
  border: none;
  color: var(--error);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  height: auto;
}

.favorite-remove:active {
  background: rgba(255, 107, 107, 0.1);
}

/* ===== SEARCH SECTION ===== */
.search-section {
  display: flex;
  flex-direction: column;
  padding: 2px 4px;
}

.search-container {
  flex-shrink: 0;
  position: relative;
  display: flex;
  margin: 0 2px;
  gap: 8px;
}

.search-input {
  flex: 1;
  height: var(--search-height-mobile);
  background: var(--btn);
  border: none;
  border-radius: var(--border-radius-large);
  color: var(--fg);
  font-size: 16px;
  padding: 0 var(--spacing-md);
}

.search-input:focus {
  outline: 2px solid var(--accent);
  position: relative;
  color: var(--fg);
}

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

.search-button {
  display: none;
}

/* ===== SEARCH RESULTS ===== */
.search-results {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow-x: hidden;
  display: none;
  height: auto; /* Dynamic height, no scroll */
}

.search-results.active {
  display: block;
  opacity: 1;
  margin-top: 5px;
  margin-left: 10px;
  margin-right: 10px;
  background: var(--card);
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-results-controls {
  display: flex;
  gap: 8px;
}

.search-control-btn {
  background: var(--btn);
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  height: auto;
  font-weight: 500;
}

.search-control-btn:active {
  background: var(--card);
}

.search-results-list {
  overflow-x: hidden;
  height: auto; /* Allow natural expansion */
}

.search-result {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  gap: 8px;
  overflow-x: hidden;
}

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

.search-result:hover {
  background: rgba(255, 255, 255, 0.05);
}

.result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.result-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
  text-align: left;
  width: 100%;
}

.result-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
}

.result-creator {
  color: var(--muted);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.result-album-indicator {
  background: var(--accent);
  color: #000;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* Expandable results */
.result-favorite {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background-color 0.2s;
}

.result-favorite.active {
  color: #ff6b6b;
}

.result-expand {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  display: none;
}

.result-favorite:active,
.result-expand:active {
  background: var(--card);
}

.expand-icon {
  transition: transform 0.2s;
}

.expand-icon.expanded {
  transform: rotate(180deg);
}

/* ===== SHARE COMPONENTS ===== */
.result-share,
.track-share {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  color: var(--accent);
}

.result-share:active,
.track-share:active {
  background: var(--card);
}

/* ===== TRACK COMPONENTS ===== */
.tracks-list {
  margin-top: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.track-item {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  text-align: left;
}

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

.track-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.track-item-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.track-title {
  width: 100%;
  font-weight: 500;
  font-size: 12px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-creator {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.track-play {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 9px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: bold;
  height: auto;
}

.track-favorite {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  height: auto;
}

.track-favorite.active {
  color: #ff6b6b;
}

.track-number {
  color: var(--muted);
  font-size: 10px;
  margin-right: 8px;
  min-width: 20px;
  text-align: right;
}

.tracks-container {
  overflow-x: clip;
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.expand-tracks {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.expand-tracks:active {
  background: rgba(110, 231, 183, 0.1);
}

.album-indicator {
  background: rgba(110, 231, 183, 0.2);
  color: var(--accent);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* ===== UTILITY COMPONENTS ===== */
.result-cover {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lazy-load-observer {
  pointer-events: none;
  height: 1px;
  visibility: hidden;
}

.loading-indicator {
  text-align: center;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ===== FEEDBACK & LOADING ===== */
.status-messages {
  margin: 0;
  min-height: 5px;
  text-align: left;
  position: relative;
  z-index: 10;
  padding: 0 16px;
  display: none;
}

/* Ensure status messages are visible when they contain messages */
.status-messages:not(:empty) {
  padding-bottom: 8px;
}

.status-message {
  background: var(--card);
  border-radius: 7px;
  font-size: 12px;
  padding: 8px 10px;
  margin: 3px 0;
  display: flex;
  display: none;
}

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

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

.loader {
  --size: var(--loader-size);
  width: var(--size);
  height: var(--size);
  border: var(--loader-border-width) solid var(--bg);
  border-radius: 50%;
  border-top-color: var(--fg);
  animation: spin var(--loader-duration) linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .loader {
    animation: none;
  }
}

.search-loading {
  padding: 5px;
  text-align: center;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

.loader-text {
  font-size: 14px;
  color: var(--muted);
}

.no-results {
  text-align: center;
  color: var(--error);
}

.load-more {
  text-align: center;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.load-more-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
  text-align: center;
  display: inline-block;
}

.load-more-btn:active {
  transform: scale(0.95);
}

/* ===== OVERLAYS & MODALS ===== */
.start-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  z-index: 1000;
  transition: opacity 0.4s, visibility 0.4s;
  display: none;
}

.start-view.hidden {
  opacity: 0;
  visibility: hidden;
}

.start-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.8rem;
  text-align: center;
}

.start-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
  text-align: center;
  max-width: 80%;
}

.start-button {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 12px 24px;
  box-shadow: 0 6px 20px rgba(110, 231, 183, 0.25);
}

.start-button:active {
  transform: scale(0.97);
}

/* ===== NEW SECTIONS ===== */
.genres-section {
  width: 100%;
  padding: 0 15px;
}

.genres-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  /*margin-bottom: 16px;*/
  text-align: center;
}

.genre-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  /*margin-top: 16px;*/
}

.genre-btn {
  height: 44px;
  font-size: 14px;
  border-radius: 8px;
  font-weight: 500;
  background: var(--btn);
  color: var(--muted);
  border: 1px solid rgba(136, 136, 136, 0.2);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genre-btn:hover {
  background: rgba(110, 231, 183, 0.08);
  border-color: var(--accent);
  transform: translateY(-0.5px);
}

.genre-btn:active {
  transform: scale(0.96);
  background: var(--accent);
  color: #000;
}

.genre-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ===== FAVORITES TAB ===== */
.favorites-section {
  display: flex;
  flex-direction: row-reverse;
  /*height: 100%;*/
}

.favorites-list {
  display: block;
}

.favorites-list:not(.active) {
  display: none;
}

/* ===== SEARCH TAB ===== */
.search-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.search-container {
  flex-shrink: 0;
}

.search-results {
  flex: 1;
  margin-left: 0;
  margin-right: -16px;
}

/* ===== IMPROVED CONTROLS ===== */
.controls {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 30px 0;
}

.volume-slider {
  display: block;
  /* Always visible */
}

/* ===== FOOTER ===== */
.stage {
  color: var(--muted);
  font-size: 10px;
}

/* ===== FOOTER ===== */
.footer {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

/* ===== MEDIA QUERIES ===== */
/* Mobile First - Progressive Enhancement */

/* Tablet (768px and up) */
@media (min-width: 768px) {
  :root {
    --art-size-mobile: var(--art-size-tablet);
    --btn-size-mobile: var(--btn-size-tablet);
    --btn-large-mobile: var(--btn-large-tablet);
    --search-height-mobile: var(--search-height-tablet);
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  .art {
    width: var(--art-size-tablet);
    height: var(--art-size-tablet);
  }

  .title {
    font-size: 20px;
  }

  .creator {
    font-size: 16px;
  }

  button {
    height: var(--btn-size-tablet);
    font-size: 16px;
  }

  .play-btn,
  .play-btn-favorite {
    width: var(--btn-large-tablet);
    height: var(--btn-large-tablet);
    font-size: 16px;
  }

  .search-input {
    height: var(--search-height-tablet);
    font-size: 15px;
  }
}

/* Desktop (1024px and up) - Complete fixed layout */
@media (min-width: 1024px) {
  :root {
    --art-size-mobile: var(--art-size-desktop);
    --btn-size-mobile: var(--btn-size-desktop);
    --btn-large-mobile: var(--btn-large-desktop);
    --search-height-mobile: var(--search-height-desktop);
    --progress-height: var(--progress-height-desktop);
  }

  /* Desktop layout - Fixed viewport */
  html,
  body {
    overflow: hidden; /* Keep fixed layout for desktop */
  }

  /* Desktop layout - Flexbox dynamic */
  .app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    max-width: 100vw;
    overflow-x: hidden;
    padding-top: 70px; /* Space for fixed header */
    padding-bottom: 50px; /* Space for fixed footer */
  }

  /* Fixed header */
  header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg);
    z-index: 1000;
    padding: var(--spacing-md) var(--spacing-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Discovery section - grows dynamically */
  .discovery-section {
    flex: 0 0 auto; /* Don't grow, size based on content */
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-sm) 0;
    min-height: 0; /* Allow shrinking */
  }

  /* Main player section - maintains size */
  .main-player-section {
    flex-shrink: 0; /* Doesn't shrink */
    padding: var(--spacing-lg) 0;
  }

  /* Fixed footer - always visible */
  .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    z-index: 10000; /* High z-index to ensure visibility */
    padding: var(--spacing-sm) var(--spacing-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  h1 {
    font-size: 28px;
    padding: var(--spacing-sm) 0; /* Reduced padding */
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 20px;
  }

  .art {
    width: var(--art-size-desktop);
    height: var(--art-size-desktop);
    max-width: none;
    margin-bottom: var(--spacing-md); /* Reduced margin */
  }

  .player-content {
    padding: 0 var(--spacing-lg); /* Reduced padding */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
  }

  .current-track-info {
    padding: var(--spacing-lg) 0; /* Reduced padding */
  }

  .title {
    font-size: 22px; /* Slightly smaller for fit */
  }

  .creator {
    font-size: 16px;
  }

  .progress-section {
    margin: var(--spacing-md) 0; /* Reduced margins */
  }

  .controls {
    margin: var(--spacing-lg) var(--spacing-sm); /* Reduced margins */
    max-width: 600px;
    margin: var(--spacing-lg) auto;
  }

  button {
    height: var(--btn-size-desktop);
    font-size: 16px; /* Slightly smaller */
  }

  .play-btn,
  .play-btn-favorite {
    width: var(--btn-large-desktop);
    height: var(--btn-large-desktop);
    font-size: 16px;
  }

  .search-input {
    height: var(--search-height-desktop);
    font-size: 16px;
  }

  .progress-bar {
    height: var(--progress-height-desktop);
  }

  .progress-bar:hover {
    height: 8px;
  }

  .player-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
  }

  /* Search results - with scroll for desktop */
  .search-results {
    overflow-y: auto;
    max-height: 60vh; /* Limit height to allow scrolling */
  }
}

/* Legacy max-width queries for specific overrides */
@media (max-width: 768px) {
  /* Keep existing tablet adjustments */
}

@media (max-width: 480px) {
  h1 {
    font-size: 18px;
    gap: 4px;
  }

  h2 {
    font-size: 16px;
  }

  h3 {
    font-size: 16px;
  }

  .current-track-info {
    min-height: 48px;
    padding: 6px 0;
    gap: 1px;
  }

  .title {
    font-size: 14px;
    line-height: 1.2;
  }

  .creator {
    font-size: 12px;
    line-height: 1.1;
  }

  .description {
    font-size: 11px;
    max-height: 28px;
    margin: 3px 0 0 0;
  }

  .qr-code {
    width: 160px !important;
    height: 100% !important;
  }

  .tooltip-content h3 {
    font-size: 16px !important;
    margin-bottom: 6px !important;
    margin-top: 5px !important;
  }

  .tooltip-content p {
    font-size: 13px !important;
    margin-bottom: 12px !important;
  }

  .donation-tooltip {
    padding: 10px !important;
  }
}

/* ===== DONATION MODAL RESPONSIVE ===== */
@media (max-width: 768px) {
  .tooltip-content {
    padding: 16px;
    max-width: 300px;
  }

  .qr-code {
    width: 180px;
    height: 100% !important;
  }
}

@media (max-width: 480px) {
  .tooltip-content {
    padding: 12px !important;
    max-width: 90vw;
  }

  .qr-code {
    width: 140px !important;
    height: 100% !important;
  }

  .tooltip-content h3 {
    font-size: 16px !important;
    margin-bottom: 6px !important;
    margin-top: 5px !important;
  }

  .tooltip-content p {
    font-size: 13px !important;
    margin-bottom: 10px !important;
  }

  .donation-tooltip {
    padding: 10px !important;
  }
}

/* ===== DONATION MODAL ===== */
.donation-tooltip {
  position: fixed;
  width: auto;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.donation-tooltip.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tooltip-content {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-heavy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  text-align: center;
}

.tooltip-close {
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.tooltip-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.tooltip-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  margin-top: 10px;
}

.tooltip-content p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 15px;
  line-height: 1.4;
}

.qr-code {
  width: 100% !important;
  height: 100% !important;
  border-radius: 8px;
  margin: 15px auto 15px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.download-qr-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.download-qr-btn:hover {
  background: var(--accent-alt);
  transform: translateY(-1px);
}

.download-qr-btn:active {
  transform: translateY(0);
}

/* ===== SEARCH HISTORY ===== */
.search-history-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  gap: 8px;
  overflow-x: hidden;
}

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

.search-history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-history-item:active {
  background: #111;
}

.history-content {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.history-query {
  font-weight: 500;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-remove {
  background: transparent;
  border: none;
  color: var(--error);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  height: auto;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.history-remove:hover {
  background: rgba(239, 68, 68, 0.1);
}

.history-remove:active {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(0.95);
}

.search-history-clear {
  padding: 12px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.clear-history-btn {
  background: var(--btn);
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.clear-history-btn:hover {
  background: rgba(110, 231, 183, 0.1);
}

.clear-history-btn:active {
  background: var(--card);
  transform: scale(0.95);
}

/* ===== PWA INSTALL BANNER ===== */
.pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-light);
  z-index: 10000;
  opacity: 0;
  transform: translateY(-100%);
  transition: all 0.3s ease;
  padding: var(--spacing-md) var(--spacing-lg);
}

.pwa-install-banner.active {
  opacity: 1;
  transform: translateY(0);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: var(--spacing-md);
}

.pwa-banner-text {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  color: var(--fg);
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
}

.pwa-icon {
  font-size: 18px;
}

.pwa-banner-buttons {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.pwa-install-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-install-btn:hover {
  background: var(--accent-alt);
  transform: translateY(-1px);
}

.pwa-install-btn:active {
  transform: translateY(0);
  background: var(--accent);
}

.pwa-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pwa-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.pwa-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

/* ===== OFFLINE MUSIC SECTION ===== */
.offline-music-section {
  margin: 15px 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.offline-music-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(110, 231, 183, 0.05);
}

.offline-music-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 4px 0;
  text-align: center;
}

.offline-music-header p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

.offline-music-list {
  max-height: 300px;
  overflow-y: auto;
}

.offline-music-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  gap: 12px;
  cursor: pointer;
}

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

.offline-music-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.offline-music-item:active {
  background: rgba(110, 231, 183, 0.1);
}

.offline-music-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.offline-music-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}

.offline-music-creator {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offline-music-size {
  color: var(--accent);
  font-size: 10px;
  margin-top: 2px;
  font-weight: 500;
}

.offline-play-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
  flex-shrink: 0;
}

.offline-play-btn:hover {
  background: var(--accent-alt);
  transform: scale(1.05);
}

.offline-play-btn:active {
  transform: scale(0.95);
}

/* Responsive adjustments for PWA banner */
@media (max-width: 768px) {
  .pwa-install-banner {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .pwa-banner-content {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
  }

  .pwa-banner-text {
    font-size: 12px;
    text-align: center;
  }

  .pwa-banner-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* ===== CURRENT TRACK SHARE BUTTON ===== */
.current-track-share {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  color: var(--accent);
  flex-shrink: 0;
}

.current-track-share:hover {
  background: rgba(110, 231, 183, 0.1);
}

.current-track-share:active {
  background: var(--card);
  transform: scale(0.95);
}
