/* ════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════ */
:root {
  --bg:           #0a0a0f;
  --surface:      rgba(255,255,255,0.04);
  --surface-hover:rgba(255,255,255,0.07);
  --border:       rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);

  --accent:       #fa2d55;         /* Apple Music red */
  --accent-dim:   rgba(250,45,85,0.18);
  --accent-glow:  rgba(250,45,85,0.35);

  --text-primary:   #f5f5f7;
  --text-secondary: #8e8e93;
  --text-tertiary:  #48484a;

  --orb-1: rgba(250,45,85,0.25);
  --orb-2: rgba(94,92,230,0.20);
  --orb-3: rgba(48,209,88,0.12);

  --radius-sm:  10px;
  --radius-md:  18px;
  --radius-lg:  28px;
  --radius-xl:  40px;

  --blur-glass: 24px;
  --shadow-card: 0 8px 40px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.06) inset;
  --shadow-btn:  0 4px 20px rgba(250,45,85,0.45);

  --font-ui:      'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition:   0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════════════════
   AMBIENT BACKGROUND ORBS
════════════════════════════════════════════════════ */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbDrift 18s ease-in-out infinite alternate;
}
.orb-1 {
  width: 520px; height: 520px;
  background: var(--orb-1);
  top: -180px; left: -160px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: var(--orb-2);
  top: 30%; right: -120px;
  animation-delay: -6s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: var(--orb-3);
  bottom: 5%; left: 30%;
  animation-delay: -12s;
}
@keyframes orbDrift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(30px, 40px) scale(1.08); }
}

/* ════════════════════════════════════════════════════
   GLASS CARD
════════════════════════════════════════════════════ */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(var(--blur-glass)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════════════ */
.main-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}
.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}
.file-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ════════════════════════════════════════════════════
   SECTION TITLES
════════════════════════════════════════════════════ */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* ════════════════════════════════════════════════════
   PLAYER SECTION
════════════════════════════════════════════════════ */
.player-section {
  padding: 28px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0 22px;
  align-items: start;
  margin-top: 24px;
}
.player-art {
  grid-row: 1 / 3;
  width: 90px; height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* ── Vinyl Disk ── */
.vinyl-disk {
  width: 90px; height: 90px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at center,
      #1a1a2e 0px,
      #1a1a2e 2px,
      #111120 3px,
      #111120 5px,
      #1c1c30 6px,
      #1c1c30 8px
    );
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 6px 24px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
}

/* Groove shimmer rings */
.vinyl-grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(250,45,85,0.12) 0%, transparent 55%),
    radial-gradient(circle at 70% 75%, rgba(94,92,230,0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* Center label */
.vinyl-label {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a1a2e, #3d1a2a);
  border: 1px solid rgba(250,45,85,0.3);
  box-shadow: 0 0 12px rgba(250,45,85,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  z-index: 2;
  position: relative;
}
.vinyl-label svg { width: 14px; height: 14px; }

/* Center hole */
.vinyl-hole {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #0a0a0f;
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 3;
}

/* Spin animation when playing */
.player-section.playing .vinyl-disk {
  animation: vinylSpin 2.8s linear infinite;
}
/* Pause gracefully */
.player-section:not(.playing) .vinyl-disk {
  animation-play-state: paused;
}

@keyframes vinylSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.player-info { padding-top: 2px; }
.player-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 5px;
}
.player-track-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.player-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Player Controls */
.player-controls {
  grid-column: 1 / -1;
  margin-top: 22px;
}

/* Progress Bar */
.progress-wrap { margin-bottom: 16px; }
.progress-track {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  cursor: pointer;
  transition: height var(--transition);
}
.progress-track:hover { height: 6px; }
.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff6b8a);
  border-radius: 4px;
  transition: width 0.1s linear;
}
.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform var(--transition), left 0.1s linear;
}
.progress-track:hover .progress-thumb { transform: translate(-50%, -50%) scale(1); }

.time-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Control Buttons */
.ctrl-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color var(--transition), transform var(--transition), background var(--transition);
}
.ctrl-btn:hover { color: var(--text-primary); transform: scale(1.1); }
.ctrl-btn:active { transform: scale(0.95); }

.skip-btn { width: 40px; height: 40px; }
.skip-btn svg { width: 20px; height: 20px; }

.play-btn {
  width: 56px; height: 56px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-btn);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.play-btn:hover {
  color: #fff;
  background: #ff4d6d;
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(250,45,85,0.6);
}
.play-btn svg { width: 22px; height: 22px; }

/* Volume */
.volume-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 220px;
  margin: 0 auto;
}
.vol-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-secondary); }
.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
.volume-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ════════════════════════════════════════════════════
   UPLOAD SECTION
════════════════════════════════════════════════════ */
.upload-section { padding: 28px; }

/* Alert */
.alert {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: fadeDown 0.3s ease;
}
.alert-success {
  background: rgba(48,209,88,0.12);
  border: 1px solid rgba(48,209,88,0.25);
  color: #30d158;
}
.alert-error {
  background: rgba(250,45,85,0.12);
  border: 1px solid rgba(250,45,85,0.25);
  color: #ff6b8a;
}
.alert > *:first-child { display: flex; align-items: center; gap: 8px; }
.alert-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.alert-success .alert-icon { background: rgba(48,209,88,0.2); }
.alert-error   .alert-icon { background: rgba(250,45,85,0.2); }

/* Share Row */
.share-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.share-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 10px 14px;
  outline: none;
  min-width: 0;
}
.btn-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
}
.btn-copy svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-copy:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
.btn-copy:active { transform: scale(0.97); }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-inner { position: relative; z-index: 1; }
.drop-icon {
  width: 56px; height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-secondary);
  transition: color var(--transition), border-color var(--transition);
}
.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon { color: var(--accent); border-color: var(--accent); }
.drop-icon svg { width: 30px; height: 30px; }

.drop-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.drop-sub { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 18px; }

.btn-browse {
  display: inline-flex;
  align-items: center;
  padding: 9px 22px;
  border-radius: 50px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-browse:hover { background: var(--surface-hover); border-color: var(--border-hover); }

.file-input-hidden {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(8px);
}
.drop-zone.drag-over .drop-overlay { opacity: 1; }

/* Selected File Preview */
.selected-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(250,45,85,0.07);
  border: 1px solid rgba(250,45,85,0.2);
  border-radius: var(--radius-sm);
  margin-top: 12px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
}
.selected-file svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.selected-file #selectedFileName { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Upload Button */
.btn-upload {
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #ff6b8a);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-upload:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-upload:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(250,45,85,0.55);
}
.btn-upload:not(:disabled):active { transform: scale(0.98); }

/* Spinner */
.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════
   LIBRARY / TRACK LIST
════════════════════════════════════════════════════ */
.library-section { position: relative; z-index: 1; }

.empty-state {
  padding: 50px 30px;
  text-align: center;
  color: var(--text-tertiary);
}
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 16px; display: block; }
.empty-state p { font-size: 0.9rem; }

.track-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  user-select: none;
}
.track-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateX(3px);
}
.track-item.active {
  background: var(--accent-dim);
  border-color: rgba(250,45,85,0.3);
}
.track-item.active .track-title { color: var(--accent); }
.track-item.active .t-num { display: none; }
.track-item.active .t-play-ico { display: flex; color: var(--accent); }

.track-index {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.t-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.t-play-ico {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.t-play-ico svg { width: 16px; height: 16px; }
.track-item:hover .t-num { display: none; }
.track-item:hover .t-play-ico { display: flex; }

.track-meta { flex: 1; min-width: 0; }
.track-title {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.track-info { font-size: 0.75rem; color: var(--text-secondary); }

.track-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.track-item:hover .track-actions { opacity: 1; }

.act-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.act-btn svg { width: 15px; height: 15px; }
.act-btn:hover { transform: scale(1.1); }
.share-btn:hover { background: rgba(48,209,88,0.15); color: #30d158; }
.delete-btn:hover { background: rgba(250,45,85,0.15); color: var(--accent); }
.delete-form { display: inline; }

/* ════════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,40,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════════════ */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .player-section { padding: 20px; gap: 0 16px; }
  .player-art { width: 72px; height: 72px; }
  .player-track-name { font-size: 1rem; }
  .upload-section { padding: 20px; }
  .drop-zone { padding: 30px 16px; }
  .track-item { padding: 12px 14px; }
  .track-actions { opacity: 1; }
  .share-row { flex-direction: column; }
}