/* =============================================================
   CRATOORA NEEDLE — needleSpecificStyles.css v6.1
   Light DOM styles for: modals, player bar, preview banner,
   update banner, sidebar backdrop, create dropdown, collection flyout,
   crate auth gate, intro / boot screen, premium promo banner.
   Web component internals live in their own shadow styles().
   No layout rules for .stereo-shell, cratoora-needle-sidebar, etc.
   Layout is fully handled by needleBaseStyles.css.
   ============================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  position: relative;
  font-size: 62.5%; /* 1rem = 10px */
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Mobile sidebar backdrop (required) ── */
#sidebarBackdrop {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#sidebarBackdrop.visible { opacity: 1; pointer-events: auto; }
@media (max-width: 768px) {
  #sidebarBackdrop { display: block; }
}

/* ══════════════════════════════════════════════
   INTRO / BOOT SCREEN
══════════════════════════════════════════════ */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #080808;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: opacity 0.7s ease;
}
.intro-screen.done {
  opacity: 0;
  pointer-events: none;
}
.intro-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.intro-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}
.intro-wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.intro-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.intro-bar {
  width: 120px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.intro-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8B5CF6, #D97706);
  border-radius: 999px;
  animation: introFill 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes introFill {
  0%   { width: 0%; }
  60%  { width: 85%; }
  100% { width: 100%; }
}

/* ══════════════════════════════════════════════
   CREATE DROPDOWN (appended to body by JS)
══════════════════════════════════════════════ */
.sp-create-dd {
  position: fixed;
  z-index: 1000;
  background: #282828;
  border-radius: 6px;
  padding: 0.3rem 0;
  min-width: 210px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.75);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(-4px);
  transition: opacity 0.16s, transform 0.16s cubic-bezier(0.23,1,0.32,1);
}
.sp-create-dd.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}
.sp-dd-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.72rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
}
.sp-dd-item:hover { background: rgba(255,255,255,0.1); }
.sp-dd-icon {
  width: 38px; height: 38px; border-radius: 6px;
  background: #3e3e3e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.8);
}
.sp-dd-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}
.sp-dd-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.42);
  margin-top: 1px;
}

/* ══════════════════════════════════════════════
   COLLECTION FLYOUT (appended to body by JS)
══════════════════════════════════════════════ */
.sp-lib-submenu {
  position: fixed;
  width: 200px;
  background: #282828;
  border-radius: 8px;
  padding: 0.35rem 0;
  box-shadow: 0 16px 48px rgba(0,0,0,0.75);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.23,1,0.32,1);
  z-index: 2000;
}
.sp-lib-submenu.flyout-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.sp-lib-sub-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.sp-lib-sub-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.sp-lib-sub-item svg {
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.12s;
}
.sp-lib-sub-item:hover svg { opacity: 1; }

/* ══════════════════════════════════════════════
   CREATE CRATE MODAL
══════════════════════════════════════════════ */
.create-crate-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.create-crate-overlay.open { opacity: 1; pointer-events: auto; }
.create-crate-modal {
  width: min(360px, 100%);
  background: #282828;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.23,1,0.32,1);
}
.create-crate-overlay.open .create-crate-modal { transform: scale(1); }
.create-crate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.create-crate-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}
.create-crate-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  transition: background 0.15s, color 0.15s;
}
.create-crate-close:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.create-crate-input {
  width: 100%;
  background: #3e3e3e;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  color: #fff;
  outline: none;
  margin-bottom: 0.65rem;
}
.create-crate-input::placeholder { color: rgba(255,255,255,0.3); }
.create-crate-input:focus { background: #444; }
.create-crate-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.btn-crate-cancel {
  flex: 1;
  padding: 0.68rem;
  border-radius: 999px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-crate-cancel:hover { background: rgba(255,255,255,0.07); }
.btn-crate-create {
  flex: 1;
  padding: 0.68rem;
  border-radius: 999px;
  background: #fff;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: #080808;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-crate-create:hover { background: rgba(255,255,255,0.88); }

/* ══════════════════════════════════════════════
   CRATE AUTH GATE MODAL
══════════════════════════════════════════════ */
.crate-auth-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.crate-auth-overlay.open { opacity: 1; pointer-events: auto; }
.crate-auth-modal {
  background: #1a1a1a;
  border-radius: 12px;
  width: min(400px, 90vw);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transform: scale(0.94);
  transition: transform 0.25s cubic-bezier(0.23,1,0.32,1);
}
.crate-auth-overlay.open .crate-auth-modal { transform: scale(1); }
.crate-auth-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  transition: background 0.15s, color 0.15s;
}
.crate-auth-close:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.crate-auth-logo {
  width: 48px; height: 48px;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}
.crate-auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.crate-auth-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  margin-bottom: 1.75rem;
  max-width: 28ch;
}
.crate-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}
.btn-crate-auth-signup {
  width: 100%;
  padding: 0.82rem;
  background: #fff;
  color: #080808;
  border: none;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: block;
  text-align: center;
  transition: background 0.15s;
}
.btn-crate-auth-signup:hover { background: rgba(255,255,255,0.88); }
.btn-crate-auth-login {
  width: 100%;
  padding: 0.8rem;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: block;
  text-align: center;
  transition: background 0.15s;
}
.btn-crate-auth-login:hover { background: rgba(255,255,255,0.14); }

/* ══════════════════════════════════════════════
   PLAYER BAR
══════════════════════════════════════════════ */
.player-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 300;
  background: #181818; border-top: 1px solid #2a2a2a;
  height: 90px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem; gap: 1rem;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1);
}
.player-bar.visible { transform: translateY(0); }
.player-progress {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}
.player-progress-fill {
  height: 100%; width: 0%;
  background: #8B5CF6;
  transition: width 0.5s linear;
  pointer-events: none;
}
.player-thumb {
  width: 52px; height: 52px;
  border-radius: 6px;
  background: linear-gradient(135deg,#8B5CF6,#D97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.player-info { flex: 1; min-width: 0; }
.player-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-artist {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.player-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  color: rgba(255,255,255,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.player-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.player-btn.play-pause {
  width: 42px; height: 42px;
  background: #fff;
  color: #080808;
}
.player-btn.play-pause:hover {
  background: rgba(255,255,255,0.88);
}
body.player-active { padding-bottom: 90px; }

/* ══════════════════════════════════════════════
   PREVIEW BANNER
══════════════════════════════════════════════ */
.cr-preview-banner {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 250;
  background: #1d1d1d; border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.85rem 1.5rem;
  padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.23,1,0.32,1);
}
.cr-preview-banner.visible { transform: translateY(0); }
.cr-preview-banner-text { flex: 1; min-width: 0; }
.cr-preview-banner-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}
.cr-preview-banner-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}
@media (max-width: 480px) { .cr-preview-banner-sub { display: none; } }
.cr-preview-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.cr-preview-btn-login {
  display: inline-flex;
  padding: 0.45rem 1rem;
  background: none;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s;
}
.cr-preview-btn-login:hover { border-color: #fff; }
.cr-preview-btn-signup {
  display: inline-flex;
  padding: 0.48rem 1.2rem;
  background: #fff;
  color: #080808;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.cr-preview-btn-signup:hover { background: rgba(255,255,255,0.88); }
.cr-preview-banner-dismiss {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: none;
  color: rgba(255,255,255,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}
.cr-preview-banner-dismiss:hover { color: #fff; }

/* ══════════════════════════════════════════════
   UPDATE BANNER
══════════════════════════════════════════════ */
.update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: linear-gradient(90deg, #1a1025 0%, #160e20 100%);
  border-bottom: 2px solid #8B5CF6;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 4px 24px rgba(139,92,246,0.2);
}
.update-banner.visible { transform: translateY(0); }
.update-banner-inner {
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.update-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.update-banner-msg {
  flex: 1;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}
.update-banner-btn {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  background: #8B5CF6;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.update-banner-btn:hover { opacity: 0.88; }
.update-banner-dismiss {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.07);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.update-banner-dismiss:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ══════════════════════════════════════════════
   MOBILE ADJUSTMENTS (overrides for player bar)
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .player-bar {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 600 !important;
  }
  body.player-active {
    padding-bottom: calc(64px + 90px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ══════════════════════════════════════════════
   PREMIUM PROMO BANNER (add‑only, light DOM)
══════════════════════════════════════════════ */
.premium-banner {
  display: block;
  width: 100%;
  margin: 0 auto 1.5rem;
  position: relative;
  box-sizing: border-box;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.premium-banner.fade-in {
  opacity: 1;
  transform: translateY(0);
}
.premium-banner.fade-out {
  opacity: 0;
  transform: translateY(-6px);
}
.premium-banner img {
  width: 100%;
  border-radius: 10px;
  display: block;
}
.premium-banner figcaption {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.premium-banner .cta {
  background: linear-gradient(135deg,#8B5CF6,#3B0764);
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
}
.premium-banner .close-banner {
  background: rgba(0,0,0,0.45);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.premium-banner .close-banner:hover {
  background: rgba(255,255,255,0.15);
}