/* ============================================================
   Music Finder – Complete Stylesheet
   4 themes: modern, ancient, milan, baggio
   ============================================================ */

/* Theme: Modern */
[data-theme="modern"] {
  --color-primary: #3498db;
  --color-primary-hover: #2980b9;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #333333;
  --color-text-muted: #777777;
  --color-border: #e0e0e0;
  --player-bg: #1a1a2e;
  --player-text: #ffffff;
}

/* Theme: Ancient */
[data-theme="ancient"] {
  --color-primary: #8b4513;
  --color-primary-hover: #6d3710;
  --color-bg: #f5f0e6;
  --color-surface: #fffdf7;
  --color-text: #3e2723;
  --color-text-muted: #795548;
  --color-border: #d4c5a9;
  --player-bg: #3e2723;
  --player-text: #f5f0e6;
}

/* Theme: Milan */
[data-theme="milan"] {
  --color-primary: #e31837;
  --color-primary-hover: #c41430;
  --color-bg: #1a1a1a;
  --color-surface: #2a2a2a;
  --color-text: #f0f0f0;
  --color-text-muted: #aaaaaa;
  --color-border: #444444;
  --player-bg: #0d0d0d;
  --player-text: #ffffff;
}

/* Theme: Baggio */
[data-theme="baggio"] {
  --color-primary: #0066cc;
  --color-primary-hover: #0052a3;
  --color-bg: #0a1628;
  --color-surface: #132744;
  --color-text: #e8edf3;
  --color-text-muted: #8899aa;
  --color-border: #1e3a5f;
  --player-bg: #060e1a;
  --player-text: #ffffff;
}

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

body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 100px;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  outline: none;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

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

.logo-icon {
  font-size: 2rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Theme Switcher */
.theme-switcher {
  display: flex;
  gap: 0.5rem;
}

.theme-btn {
  padding: 0.4rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
}

.theme-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg);
}

.theme-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Theme-specific button colors for better contrast */
[data-theme="modern"] .theme-btn {
  border-color: #3498db;
}
[data-theme="ancient"] .theme-btn {
  border-color: #8b4513;
}
[data-theme="milan"] .theme-btn {
  border-color: #e31837;
}
[data-theme="baggio"] .theme-btn {
  border-color: #0066cc;
}

/* User Area */
.user-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#username {
  font-weight: 500;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-small {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

/* Main Layout */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 2rem;
}

/* Search Section */
.search-section {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 0;
}

.search-container {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.3s;
}

.search-input:focus {
  border-color: var(--color-primary);
}

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

.search-btn {
  padding: 1rem 2rem;
}

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

/* Results Section */
.results-section h2 {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  background: var(--color-primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  background: var(--color-surface);
  border-radius: 8px;
  padding: 1.2rem;
  border: 1px solid var(--color-border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.result-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
}

.result-title:hover {
  color: var(--color-primary);
}

.result-source {
  background: var(--color-primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-left: 0.5rem;
}

.result-snippet {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

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

.result-actions .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
}

.result-actions .btn-play {
  background: var(--color-primary);
  color: white;
}

.result-actions .btn-download {
  background: #27ae60;
  color: white;
}

.result-actions .btn-fav {
  background: #e74c3c;
  color: white;
}

.result-actions .btn-link {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

/* Player Section */
.player-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--player-bg);
  color: var(--player-text);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  z-index: 100;
}

.player-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.now-playing {
  flex: 0 0 200px;
}

.song-info h3 {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info p {
  font-size: 0.8rem;
  opacity: 0.7;
}

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

.control-btn {
  color: var(--player-text);
  font-size: 1.5rem;
  transition: transform 0.2s;
}

.control-btn:hover {
  transform: scale(1.1);
}

.play-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--player-text);
  color: var(--player-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.progress-container {
  flex: 1;
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  cursor: pointer;
}

.progress {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s;
}

.time-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.3rem;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--player-text);
}

.volume-control input[type="range"] {
  width: 80px;
}

/* Sidebar */
.sidebar {
  background: var(--color-surface);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  height: fit-content;
  position: sticky;
  top: 100px;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}

.tab-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.tab-content.active {
  display: block;
}

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

.tab-header h3 {
  font-size: 1rem;
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.song-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  background: var(--color-bg);
  border-radius: 8px;
  transition: background 0.3s;
}

.song-item:hover {
  background: var(--color-border);
}

.song-item.clickable {
  cursor: pointer;
}

.song-item-info {
  flex: 1;
  overflow: hidden;
}

.song-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-item-artist {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.song-item-actions {
  display: flex;
  gap: 0.3rem;
}

.song-item-actions button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all 0.3s;
}

.song-item-actions button:hover {
  background: var(--color-primary);
  color: white;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  position: relative;
  border: 1px solid var(--color-border);
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.close:hover {
  color: var(--color-text);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}

.form-group input:focus {
  border-color: var(--color-primary);
}

/* Loading & Error */
.loading, .error, .empty {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
}

.error {
  color: #e74c3c;
}

/* Responsive */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
    padding: 1rem;
  }
  
  .theme-switcher {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  .main {
    padding: 1rem;
  }
  
  .player-container {
    flex-wrap: wrap;
    padding: 0.8rem 1rem;
    gap: 0.5rem;
  }
  
  .now-playing {
    flex: 1;
    min-width: 120px;
  }
  
  .progress-container {
    order: 3;
    width: 100%;
  }
}

/* Local Music Hint */
.local-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: var(--color-bg);
  border-radius: 4px;
}
