/* ============================================================
   css/discovery.css — PLAY MY v2.0.0
   Feed Vertical de Descoberta — Premium Rolex
   ============================================================ */

/* ============================================================
   CONTAINER PRINCIPAL
   ============================================================ */
.discovery-feed {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.discovery-feed.visible {
  opacity: 1;
  pointer-events: auto;
}

body.discovery-open {
  overflow: hidden !important;
}

/* ============================================================
   HEADER (reforçado, sempre acima)
   ============================================================ */
.discovery-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
  z-index: 1000000 !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  pointer-events: none;
}

.discovery-header > * {
  pointer-events: auto !important;
}

.discovery-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  font-size: 18px;
  transition: background 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  z-index: 1000001 !important;
  pointer-events: auto !important;
}

.discovery-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.discovery-close:active {
  transform: scale(0.95);
}

.discovery-title {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.discovery-title i {
  color: #C9A227;
  font-size: 18px;
  filter: drop-shadow(0 0 8px rgba(201, 162, 39, 0.5));
}

.discovery-counter {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 100px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(201, 162, 39, 0.3);
}

/* ============================================================
   CARDS CONTAINER
   ============================================================ */
.discovery-cards {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

/* ============================================================
   CARD
   ============================================================ */
.discovery-card {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  overflow: hidden;
  z-index: 999998;
}

.discovery-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  z-index: 999999;
}

/* ============================================================
   CAPA
   ============================================================ */
.discovery-cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #000;
  filter: brightness(0.85) saturate(1.1);
  pointer-events: none;
  transform: scale(1.05);
  transition: transform 8s ease-out;
}

.discovery-card.active .discovery-cover {
  transform: scale(1);
}

.discovery-cover-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 25%),
    linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.75) 35%, transparent 75%),
    radial-gradient(circle at 20% 80%, rgba(0, 96, 57, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(201, 162, 39, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

/* Overlay especial para artista */
.discovery-cover-overlay.artista {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 30%),
    linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(0, 96, 57, 0.6) 40%, transparent 75%),
    radial-gradient(circle at 50% 30%, rgba(201, 162, 39, 0.2) 0%, transparent 60%);
}

/* Overlay especial para playlist */
.discovery-cover-overlay.playlist {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 30%),
    linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(90, 60, 180, 0.5) 40%, transparent 75%);
}

/* ============================================================
   CAPA ESPECIAL PARA PLAYLIST
   ============================================================ */
.discovery-cover.playlist-cover {
  background: linear-gradient(135deg, #006039 0%, #4B2E83 50%, #C9A227 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: brightness(1);
}

.playlist-icon-wrap {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.playlist-icon-wrap i {
  font-size: 120px;
  color: rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.5));
}

/* ============================================================
   BADGE DE TIPO (música / artista / playlist)
   ============================================================ */
.discovery-card-badge {
  position: absolute;
  top: calc(80px + env(safe-area-inset-top));
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 999995;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.discovery-card-badge.tipo-musica {
  background: rgba(0, 96, 57, 0.6);
  color: #fff;
  border: 1px solid rgba(0, 150, 100, 0.5);
}

.discovery-card-badge.tipo-artista {
  background: rgba(201, 162, 39, 0.85);
  color: #000;
  border: 1px solid rgba(201, 162, 39, 0.5);
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.4);
}

.discovery-card-badge.tipo-playlist {
  background: rgba(120, 80, 200, 0.8);
  color: #fff;
  border: 1px solid rgba(150, 110, 230, 0.5);
  box-shadow: 0 4px 20px rgba(120, 80, 200, 0.4);
}

/* ============================================================
   INFO (com border dourada no card ativo)
   ============================================================ */
.discovery-info {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 210px;
  color: #fff;
  z-index: 999990;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  padding-left: 16px;
  border-left: 3px solid transparent;
  transition: border-color 0.4s ease, padding-left 0.4s ease;
}

.discovery-card.active .discovery-info {
  border-left-color: #C9A227;
  padding-left: 20px;
  box-shadow: -12px 0 32px -8px rgba(201, 162, 39, 0.3);
}

.discovery-genero {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #C9A227;
  margin-bottom: 10px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 100px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.discovery-track-title {
  font-size: 30px;
  font-weight: 900;
  margin: 0 0 8px 0;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: #F5F5F0;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

.discovery-card.active .discovery-track-title {
  animation: titleSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes titleSlideUp {
  0% { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

.discovery-track-artist {
  font-size: 17px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 16px 0;
  letter-spacing: 0.01em;
}

.discovery-stats {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  flex-wrap: wrap;
}

.discovery-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.discovery-stats i {
  color: #C9A227;
  font-size: 14px;
}

/* ============================================================
   AÇÕES
   ============================================================ */
.discovery-actions {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 40px;
  bottom: calc(40px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
  z-index: 999999;
  pointer-events: auto;
}

.discovery-actions.artista,
.discovery-actions.playlist {
  grid-template-columns: 1.6fr 1fr;
}

.discovery-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.3s ease, background 0.3s ease;
  font-family: inherit;
  text-align: center;
  min-height: 72px;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.discovery-action::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.discovery-action:hover::before {
  opacity: 1;
}

.discovery-action:active {
  transform: scale(0.95);
}

.discovery-action i {
  font-size: 22px;
  line-height: 1;
}

.discovery-action span {
  font-size: 12px;
  font-weight: 700;
}

.discovery-action small {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
}

.discovery-action.big {
  min-height: 80px;
  font-size: 14px;
}

.discovery-action.big i {
  font-size: 28px;
}

.discovery-action.big span {
  font-size: 14px;
}

/* Botão Investir */
.discovery-action.invest {
  background: linear-gradient(135deg, #7A5E1F 0%, #C9A227 60%, #E5C558 100%);
  color: #000;
  box-shadow: 0 6px 24px rgba(201, 162, 39, 0.4);
}

.discovery-action.invest i {
  color: #000;
}

.discovery-action.invest:hover {
  box-shadow: 0 8px 32px rgba(201, 162, 39, 0.7);
}

/* Botão Ouvir — com pulso suave */
.discovery-action.play {
  background: linear-gradient(135deg, #006039 0%, #00854D 60%, #00A860 100%);
  box-shadow: 0 6px 24px rgba(0, 96, 57, 0.5);
  animation: playPulse 3s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(0, 96, 57, 0.4); }
  50%      { box-shadow: 0 8px 36px rgba(0, 168, 96, 0.7); }
}

.discovery-action.play:hover {
  box-shadow: 0 10px 40px rgba(0, 168, 96, 0.9);
  animation: none;
}

/* Botão Favoritar */
.discovery-action.fav {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.discovery-action.fav:hover {
  background: rgba(255, 0, 80, 0.3);
  border-color: rgba(255, 0, 80, 0.5);
}

/* Botão Compartilhar */
.discovery-action.share {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.discovery-action.share:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Botão Seguir */
.discovery-action.follow {
  background: linear-gradient(135deg, #C9A227 0%, #E5C558 100%);
  color: #000;
  box-shadow: 0 6px 24px rgba(201, 162, 39, 0.4);
}

.discovery-action.follow i {
  color: #000;
}

.discovery-action.follow:hover {
  box-shadow: 0 8px 32px rgba(201, 162, 39, 0.7);
}

/* ============================================================
   PROGRESSO (barra horizontal com shimmer)
   ============================================================ */
.discovery-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1000000;
  overflow: hidden;
}

.discovery-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #006039 0%, #C9A227 100%);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.discovery-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   HINT
   ============================================================ */
.discovery-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 999999;
  animation: discoveryHintPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

.discovery-hint i {
  font-size: 14px;
}

@keyframes discoveryHintPulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 0.85; transform: translateX(-50%) translateY(-4px); }
}

/* ============================================================
   ESTADO VAZIO
   ============================================================ */
.discovery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 40px;
}

.discovery-empty i {
  font-size: 64px;
  color: #C9A227;
  margin-bottom: 20px;
  opacity: 0.5;
}

.discovery-empty h2 {
  font-size: 20px;
  font-weight: 700;
  color: #F5F5F0;
  margin-bottom: 8px;
}

.discovery-empty p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 480px) {
  .discovery-track-title {
    font-size: 26px;
  }

  .discovery-info {
    bottom: 200px;
  }

  .discovery-actions {
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 8px;
    left: 14px;
    right: 14px;
  }

  .discovery-action {
    padding: 12px 6px;
    min-height: 66px;
  }

  .discovery-action i {
    font-size: 20px;
  }
}

/* ============================================================
   REDUZIR MOVIMENTO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .discovery-feed,
  .discovery-card,
  .discovery-progress-bar,
  .discovery-hint,
  .discovery-action.play,
  .discovery-card.active .discovery-track-title,
  .discovery-card.active .discovery-cover {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   SAFE AREA (iOS notch)
   ============================================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  .discovery-actions {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ============================================================
   FORÇA MÁXIMA — feed SEMPRE ganha de qualquer elemento
   ============================================================ */
#discoveryFeed.discovery-feed {
  z-index: 999999 !important;
}

#discoveryFeed.discovery-feed:not(.visible) {
  pointer-events: none !important;
}

#discoveryFeed.discovery-feed.visible {
  pointer-events: auto !important;
}

body.discovery-open .app-header,
body.discovery-open #sidebar,
body.discovery-open .sidebar,
body.discovery-open #playerSpotify,
body.discovery-open .player-miv,
body.discovery-open #loadingScreen,
body.discovery-open .loading-screen,
body.discovery-open #toastContainer {
  z-index: 1 !important;
}

body.discovery-open #playerSpotify {
  display: none !important;
}
/* ============================================================
   v2.1.0 — Cards do YouTube
   ============================================================ */
.discovery-card-badge.tipo-youtube {
  background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
  color: #fff;
  border: 1px solid rgba(255, 0, 0, 0.5);
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
}

.discovery-actions.youtube {
  grid-template-columns: 1.8fr 1fr 1fr;
}

.discovery-action.play.big {
  grid-column: span 1;
}
