/* ═══════════════════════════════════════════════════
   SoundVault – Clean White & Emerald Green Theme
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --bg:         #f8fafc;
  --bg2:        #ffffff;
  --glass:      #ffffff;
  --glass-b:    #f1f5f9;
  --border:     #e2e8f0;
  --border-h:   #10b981;
  --purple:     #10b981;
  --purple-d:   #059669;
  --cyan:       #0d9488;
  --cyan-d:     #0f766e;
  --text:       #0f172a;
  --text-2:     #475569;
  --text-3:     #94a3b8;
  --success:    #10b981;
  --error:      #ef4444;
  --warn:       #f59e0b;
  --r-card:     16px;
  --r-pill:     999px;
  --shadow:     0 4px 20px -2px rgba(16, 185, 129, 0.12), 0 2px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg:  0 20px 40px -15px rgba(16, 185, 129, 0.2);
  --trans:      all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
  animation: drift 20s ease-in-out infinite alternate;
}
.orb-1 { width: 600px; height: 600px; background: #6ee7b7; top: -200px; left: -100px; }
.orb-2 { width: 500px; height: 500px; background: #99f6e4; bottom: -150px; right: -100px; }

@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px,30px) scale(1.08); }
}

.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-text { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.logo-accent { background: linear-gradient(135deg, var(--purple), var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.header-right { display: flex; align-items: center; gap: 12px; }

.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 6px 16px; border-radius: var(--r-pill);
  color: var(--text-2); text-decoration: none;
  font-size: 0.85rem; font-weight: 600; transition: var(--trans);
}
.nav-link:hover { color: var(--text); background: var(--glass-b); }
.nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--purple), var(--purple-d));
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-pill);
  font-size: 0.75rem; font-weight: 600; border: 1px solid;
}
.badge-warn { background: #fffbeb; border-color: #fde68a; color: #d97706; }
.badge-ok   { background: #ecfdf5; border-color: #a7f3d0; color: #059669; }
.badge-dot  { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.hero {
  position: relative; z-index: 1; text-align: center; padding: 4rem 1.5rem 2.5rem;
}
.hero-eyebrow {
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--purple-d); margin-bottom: 0.8rem;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15;
  letter-spacing: -0.03em; margin-bottom: 0.8rem; color: var(--text);
}
.gradient-text {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 1rem; color: var(--text-2); margin-bottom: 2rem; font-weight: 500; }

.search-wrap { max-width: 680px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; gap: 12px;
  background: #ffffff; border: 2px solid #e2e8f0;
  border-radius: var(--r-pill); padding: 6px 6px 6px 22px;
  transition: var(--trans); box-shadow: var(--shadow);
}
.search-box:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}
.search-icon { width: 20px; height: 20px; color: var(--text-3); flex-shrink: 0; }

#searchInput {
  flex: 1; background: none; border: none; outline: none;
  font-family: 'Inter', sans-serif; font-size: 1rem; color: var(--text); font-weight: 500;
}
#searchInput::placeholder { color: var(--text-3); }

.search-submit {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-d));
  border: none; cursor: pointer; color: white;
  transition: var(--trans); flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.search-submit:hover { transform: scale(1.08); filter: brightness(1.1); }

.search-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 1rem; }
.search-tag {
  padding: 6px 16px; border-radius: var(--r-pill);
  background: #ffffff; border: 1px solid #e2e8f0;
  color: var(--text-2); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: var(--trans); box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.search-tag:hover { background: #ecfdf5; border-color: #a7f3d0; color: var(--purple-d); }

.url-toggle-wrap { margin-top: 1.2rem; }
.url-toggle-btn {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 0.85rem; font-weight: 600; font-family: 'Inter', sans-serif;
  transition: var(--trans); text-decoration: underline; text-underline-offset: 3px;
}
.url-toggle-btn:hover { color: var(--purple-d); }

.url-direct-wrap { max-width: 680px; margin: 0.8rem auto 0; }
.url-direct-box {
  display: flex; gap: 8px; background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 8px; box-shadow: var(--shadow);
}
#urlDirectInput { flex: 1; background: none; border: none; outline: none; font-size: 0.9rem; color: var(--text); padding: 0 10px; }

.btn-primary {
  padding: 10px 22px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--purple-d));
  border: none; cursor: pointer; color: white;
  font-size: 0.88rem; font-weight: 700; transition: var(--trans);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-ghost {
  padding: 10px 28px; border-radius: var(--r-pill);
  background: #ffffff; border: 1px solid var(--border);
  cursor: pointer; color: var(--text-2); font-size: 0.88rem; font-weight: 600; transition: var(--trans);
}
.btn-ghost:hover { background: var(--glass-b); border-color: var(--purple); color: var(--purple-d); }

.main-content { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 6rem; position: relative; z-index: 1; }

.loading-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 4rem 0; color: var(--text-2); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #e2e8f0; border-top-color: var(--purple); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  display: flex; align-items: center; gap: 10px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--r-card);
  padding: 14px 18px; color: #dc2626; font-size: 0.9rem; font-weight: 500; margin-bottom: 1.5rem;
}

.section-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 1.5rem; }
.section-title { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.results-count { font-size: 0.8rem; color: var(--purple-d); background: #ecfdf5; border: 1px solid #a7f3d0; padding: 2px 10px; border-radius: var(--r-pill); font-weight: 700; }

.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

.music-card {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-card);
  overflow: hidden; cursor: pointer; transition: var(--trans); box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.music-card:hover {
  border-color: var(--purple); transform: translateY(-4px); box-shadow: var(--shadow-lg);
}

.card-thumb-wrap { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #f1f5f9; }
.card-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.music-card:hover .card-thumb { transform: scale(1.06); }

.card-overlay {
  position: absolute; inset: 0; background: rgba(15, 23, 42, 0.4);
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--trans);
}
.music-card:hover .card-overlay { opacity: 1; }

.play-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-d));
  display: flex; align-items: center; justify-content: center; color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}
.play-btn svg { width: 20px; height: 20px; margin-left: 2px; }

.card-duration { position: absolute; bottom: 6px; right: 8px; background: rgba(15, 23, 42, 0.8); color: white; font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; }

.card-body { padding: 14px; }
.card-title { font-size: 0.88rem; font-weight: 700; color: var(--text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.card-artist { font-size: 0.78rem; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-views { font-size: 0.72rem; color: var(--text-3); margin-top: 4px; }

.queue-section { margin-top: 3rem; }
.queue-list { display: flex; flex-direction: column; gap: 10px; margin-top: 1rem; }
.queue-item { display: flex; align-items: center; gap: 14px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-card); padding: 14px 18px; box-shadow: var(--shadow); }
.qi-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.qi-info { flex: 1; min-width: 0; }
.qi-title { font-size: 0.88rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qi-meta { font-size: 0.75rem; color: var(--text-2); margin-top: 2px; }

.qi-badge { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid; text-transform: uppercase; }
.qi-badge.downloading { background: #ecfdf5; border-color: #a7f3d0; color: var(--purple-d); }
.qi-badge.done        { background: #ecfdf5; border-color: #a7f3d0; color: #059669; }
.qi-badge.error       { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

.qi-progress-bar { width: 100%; height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.qi-progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--purple), var(--cyan)); transition: width 0.5s ease; }

.panel-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); }
.download-panel {
  position: fixed; top: 0; right: 0; z-index: 201; width: 100%; max-width: 420px; height: 100vh;
  background: #ffffff; border-left: 1px solid #e2e8f0; overflow-y: auto; box-shadow: -10px 0 30px rgba(0,0,0,0.1);
}
.panel-close { position: absolute; top: 14px; right: 14px; z-index: 10; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); transition: var(--trans); }
.panel-close:hover { background: #e2e8f0; color: var(--text); }

.panel-thumb-wrap { position: relative; width: 100%; aspect-ratio: 16/9; }
.panel-thumb { width: 100%; height: 100%; object-fit: cover; }
.panel-thumb-gradient { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, #ffffff 100%); }

.panel-info { padding: 0 1.5rem 1rem; }
.panel-title { font-size: 1.1rem; font-weight: 800; color: var(--text); line-height: 1.35; margin-bottom: 4px; }
.panel-artist { font-size: 0.88rem; color: var(--purple-d); font-weight: 600; }

.format-section { padding: 0 1.5rem; }
.format-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 10px; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.format-btn {
  display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border-radius: 12px;
  background: #ffffff; border: 2px solid #e2e8f0; cursor: pointer; color: var(--text-2); transition: var(--trans);
}
.format-btn:hover { border-color: #a7f3d0; color: var(--purple-d); }
.format-btn.active { background: #ecfdf5; border-color: var(--purple); color: var(--purple-d); font-weight: 700; }
.fmt-name { font-size: 0.95rem; font-weight: 800; }
.fmt-desc { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; }
.format-btn.active .fmt-desc { color: var(--purple-d); }

.btn-download {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: calc(100% - 3rem); margin: 1.5rem 1.5rem 0; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--purple), var(--purple-d));
  border: none; cursor: pointer; color: white; font-size: 1rem; font-weight: 800;
  transition: var(--trans); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}
.btn-download:hover { transform: translateY(-2px); filter: brightness(1.08); }

.panel-progress { margin: 1.2rem 1.5rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--r-card); padding: 16px; }
.progress-header { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; margin-bottom: 10px; }

.hidden { display: none !important; }
