/* ============================================================================
   css/profile.css — Página pública da Trezzer (/profile.html?u=username)
   ============================================================================ */

body.profile-body {
  background: var(--pv-bg, #09090b);
  color: var(--pv-text, #ffffff);
  min-height: 100vh;
  transition: background 200ms ease, color 200ms ease;
  position: relative;
}

/* Plano de fundo personalizado (Pro/Business): camada fixa atrás de tudo,
   ampliada além da tela para o blur não deixar borda transparente à mostra. */
.pv-bg-image {
  display: none;
  position: fixed;
  inset: -30px;
  background-position: center;
  background-size: cover;
  z-index: 0;
  pointer-events: none;
}
body.profile-body--custom-bg .profile-page { position: relative; z-index: 1; }
body.profile-body--custom-bg { background: rgba(0, 0, 0, 0.35); }

.profile-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 56px 20px 60px;
  min-height: 100vh;
}

.profile-header { text-align: center; margin-bottom: 30px; }

.profile-avatar {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 18px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--pv-primary, #7c3aed), #38bdf8);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 32px; color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-name { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.profile-handle { opacity: 0.55; font-size: 14px; margin-top: 2px; }
.profile-bio { opacity: 0.85; font-size: 14px; margin-top: 14px; line-height: 1.6; }
.profile-location { opacity: 0.5; font-size: 13px; margin-top: 10px; display: inline-flex; align-items: center; gap: 5px; }
.profile-location svg { width: 13px; height: 13px; }

.profile-share {
  display: flex; justify-content: center; gap: 10px; margin-top: 20px;
}
.profile-share button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  font-size: 12.5px; font-weight: 600; color: inherit;
}
.profile-share button svg { width: 13px; height: 13px; }

/* ---------------------------- OUVINDO AGORA (SPOTIFY) ---------------------------- */

.spotify-now-playing { display: none; margin-top: 18px; text-align: left; }
.spotify-now-playing.is-visible { display: block; }

.spotify-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--pv-radius, 12px);
  background: rgba(29, 185, 84, 0.1); border: 1px solid rgba(29, 185, 84, 0.3);
  color: inherit; transition: transform 160ms ease, border-color 160ms ease;
}
.spotify-card:hover { transform: translateY(-2px); border-color: #1DB954; }

.spotify-card__art {
  width: 48px; height: 48px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}
.spotify-card__art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.spotify-card__body { min-width: 0; flex: 1; }
.spotify-card__label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: #1DB954; margin-bottom: 3px;
}
.spotify-card__label svg { width: 12px; height: 12px; flex-shrink: 0; }
.spotify-card__track {
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spotify-card__artist {
  font-size: 12px; opacity: 0.65;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spotify-card__progress {
  margin-top: 6px; height: 3px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15); overflow: hidden;
}
.spotify-card__progress-fill { height: 100%; background: #1DB954; border-radius: var(--radius-full); }

/* "Equalizador" animado — 3 barrinhas pulsando, indicando que está tocando */
.spotify-card__bars {
  display: flex; align-items: flex-end; gap: 2.5px; height: 16px; flex-shrink: 0; margin-right: 2px;
}
.spotify-card__bars span {
  width: 3px; background: #1DB954; border-radius: 2px;
  animation: spotify-bar 1.1s ease-in-out infinite;
}
.spotify-card__bars span:nth-child(1) { animation-delay: -0.9s; }
.spotify-card__bars span:nth-child(2) { animation-delay: -0.4s; }
.spotify-card__bars span:nth-child(3) { animation-delay: -1.2s; }
@keyframes spotify-bar {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .spotify-card__bars span { animation: none; height: 10px; }
}

/* ---------------------------- PLAYER FLUTUANTE DE PLAYLIST (SPOTIFY) ---------------------------- */
/* Fixo no canto inferior direito, por cima do conteúdo, sem ocupar espaço
   no fluxo da página (ver js/spotify-player.js). Some completamente
   (display:none, ver initSpotifyFloatingPlayer) quando não há playlist
   ativa — não deixa nem um contêiner vazio no DOM. */

#spotify-floating-player {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 45; /* acima do conteúdo da BioPage, abaixo de toasts/modais (que não existem nesta página, mas mantém a mesma escala do resto do app) */
  max-width: calc(100vw - 20px - env(safe-area-inset-right, 0px));
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 320ms ease, transform 320ms ease;
  pointer-events: none;
}
#spotify-floating-player.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.spotify-fp {
  width: min(300px, calc(100vw - 20px));
  max-width: 100%;
  background: rgba(17, 17, 19, 0.82); /* var(--card) com transparência para o leve efeito glass pedido */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: width 220ms ease;
}

.spotify-fp__header {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 10px 10px 12px;
}
.spotify-fp__art {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: #1DB954 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.spotify-fp__art svg { width: 15px; height: 15px; }
.spotify-fp__art.has-image svg { display: none; }
/* "Início suave": leve pulsação enquanto espera pra começar a tocar (ver
   SPOTIFY_SOFT_START_DELAY_MS em js/spotify-player.js) — só um sinal visual
   de que a transição é intencional, não simula áudio nenhum. */
.spotify-fp__art.is-preparing { animation: spotifyFpPulse 1.1s ease-in-out infinite; }
@keyframes spotifyFpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.spotify-fp__title {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.spotify-fp__icon-btn {
  width: 26px; height: 26px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; transition: background 150ms ease, color 150ms ease;
}
.spotify-fp__icon-btn:hover { background: var(--card-hover); color: var(--text); }
.spotify-fp__icon-btn svg { width: 14px; height: 14px; }

.spotify-fp__body {
  border-top: 1px solid var(--border);
  transition: grid-template-rows 220ms ease;
  display: grid;
  grid-template-rows: 1fr;
}
.spotify-fp__embed { overflow: hidden; line-height: 0; }
.spotify-fp__embed iframe { display: block; border: none; }

.spotify-fp__hint {
  padding: 0 12px 8px;
  font-size: 11px; color: var(--muted-2); text-align: center;
  min-height: 0;
}
.spotify-fp__hint:empty { padding: 0; }

/* Estado minimizado: some com o corpo (embed) e mantém só o cabeçalho, bem compacto. */
.spotify-fp.is-collapsed .spotify-fp__body { display: none; }
.spotify-fp.is-collapsed { width: max-content; }

@media (max-width: 640px) {
  #spotify-floating-player {
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 20px - env(safe-area-inset-right, 0px));
  }
  .spotify-fp { width: min(280px, calc(100vw - 20px)); }
  /* Alvos de toque maiores no celular (recomendação ~40px+ pra dedo, sem
     deixar o ícone visualmente maior que o resto do cabeçalho). */
  .spotify-fp__icon-btn { width: 34px; height: 34px; }
  .spotify-fp__icon-btn svg { width: 16px; height: 16px; }
  .spotify-fp__header { padding: 8px 6px 8px 12px; gap: 6px; }
}

@media (max-width: 360px) {
  .spotify-fp { width: calc(100vw - 20px); }
  .spotify-fp__art { width: 26px; height: 26px; }
  .spotify-fp__title { font-size: 12px; }
}

.profile-links { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.profile-link {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: var(--pv-radius, 12px);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  font-size: 14.5px; font-weight: 600;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.profile-link:hover { transform: translateY(-2px); border-color: var(--pv-primary, #7c3aed); background: rgba(255,255,255,0.09); }
.profile-link svg { width: 17px; height: 17px; flex-shrink: 0; }

.profile-socials { display: flex; justify-content: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.profile-social {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform 160ms ease, border-color 160ms ease;
}
.profile-social:hover { transform: translateY(-2px) scale(1.05); border-color: var(--pv-primary, #7c3aed); }
.profile-social svg { width: 17px; height: 17px; }

.profile-projects { margin-top: 40px; }
.profile-projects h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.55; margin-bottom: 16px; }
.profile-project-list { display: flex; flex-direction: column; gap: 14px; }
.profile-project {
  border-radius: var(--radius-lg); overflow: hidden;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  display: block;
}
.profile-project__img { width: 100%; height: 150px; object-fit: cover; display: block; }
.profile-project__body { padding: 16px; }
.profile-project__title { font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.profile-project__desc { font-size: 13px; opacity: 0.7; line-height: 1.5; margin-bottom: 10px; }
.profile-project__tech { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-project__tech span { font-size: 11px; padding: 3px 9px; border-radius: var(--radius-full); background: rgba(255,255,255,0.08); }

.profile-footer { text-align: center; margin-top: 46px; opacity: 0.35; font-size: 12px; }
.profile-footer a { font-weight: 700; }

.profile-loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

.profile-notfound { text-align: center; padding: 100px 20px; }
.profile-notfound h1 { font-size: 22px; margin-bottom: 10px; }
.profile-notfound p { opacity: 0.6; font-size: 14px; margin-bottom: 24px; }

/* ---------------------------- SELO DE FUNDADOR (exclusivo, não vem em nenhum plano) ---------------------------- */

.profile-page { position: relative; }
.profile-page--founder::before {
  content: "";
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 520px; height: 320px; max-width: 140vw;
  background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.22), transparent 70%);
  pointer-events: none; z-index: 0;
}
.profile-page--founder .profile-header,
.profile-page--founder .profile-links,
.profile-page--founder .profile-socials,
.profile-page--founder .profile-projects { position: relative; z-index: 1; }

.profile-avatar-ring {
  width: 100px; height: 100px;
  margin: 0 auto 18px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 0deg, #f59e0b, #fde68a, #fbbf24, #f59e0b, #fde68a, #f59e0b);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.35);
}
.profile-avatar-ring .profile-avatar {
  margin: 0; width: 100%; height: 100%;
  box-shadow: 0 0 0 3px var(--pv-bg, #09090b);
}

/* Empilha todos os selos (fundador, admin, hunter, membro antigo) um embaixo
   do outro, na ordem de importância em que já são inseridos no HTML. */
.profile-badges {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 12px;
}
.profile-badges:empty { display: none; margin-top: 0; }

.profile-founder-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: linear-gradient(120deg, #fde68a, #f59e0b);
  color: #1c1207; font-weight: 700; font-size: 11.5px; letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4);
}
.profile-founder-badge svg { width: 12px; height: 12px; }

/* ---------------------------- SELO DE ADMIN (mesmo destaque do fundador, cor vermelha) ---------------------------- */

.profile-page--admin::before {
  content: "";
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 520px; height: 320px; max-width: 140vw;
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.22), transparent 70%);
  pointer-events: none; z-index: 0;
}
.profile-page--admin .profile-header,
.profile-page--admin .profile-links,
.profile-page--admin .profile-socials,
.profile-page--admin .profile-projects { position: relative; z-index: 1; }

.profile-avatar-ring--admin {
  background: conic-gradient(from 0deg, #ef4444, #fca5a5, #dc2626, #ef4444, #fca5a5, #ef4444);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.35);
}

.profile-founder-badge--admin {
  background: linear-gradient(120deg, #fca5a5, #dc2626);
  color: #2a0505;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.4);
}

/* ---------------------------- SELO DE HUNTER (achou um bug no sistema) ---------------------------- */

.profile-page--hunter::before {
  content: "";
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 520px; height: 320px; max-width: 140vw;
  background: radial-gradient(ellipse at center, rgba(34, 197, 94, 0.22), transparent 70%);
  pointer-events: none; z-index: 0;
}
.profile-page--hunter .profile-header,
.profile-page--hunter .profile-links,
.profile-page--hunter .profile-socials,
.profile-page--hunter .profile-projects { position: relative; z-index: 1; }

.profile-avatar-ring--hunter {
  background: conic-gradient(from 0deg, #22c55e, #bbf7d0, #16a34a, #22c55e, #bbf7d0, #22c55e);
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.35);
}

.profile-founder-badge--hunter {
  background: linear-gradient(120deg, #bbf7d0, #16a34a);
  color: #052e12;
  box-shadow: 0 3px 12px rgba(22, 163, 74, 0.4);
  cursor: help;
}

/* ---------------------------- SELO DE CONTA OFICIAL (exclusivo, cor cinza, com verificado) ---------------------------- */
/* Só a conta oficial da Trezzer tem is_official = true — não tem botão pra
   isso em lugar nenhum do app, só via SQL Editor (ver database.sql). Tem
   prioridade visual sobre fundador/admin/hunter, mesmo que a conta também
   seja fundador por baixo dos panos. */

.profile-page--official::before {
  content: "";
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 520px; height: 320px; max-width: 140vw;
  background: radial-gradient(ellipse at center, rgba(156, 163, 175, 0.22), transparent 70%);
  pointer-events: none; z-index: 0;
}
.profile-page--official .profile-header,
.profile-page--official .profile-links,
.profile-page--official .profile-socials,
.profile-page--official .profile-projects { position: relative; z-index: 1; }

.profile-avatar-ring--official {
  background: conic-gradient(from 0deg, #9ca3af, #e5e7eb, #6b7280, #9ca3af, #e5e7eb, #9ca3af);
  box-shadow: 0 0 22px rgba(156, 163, 175, 0.4);
}

.profile-founder-badge--official {
  background: linear-gradient(120deg, #e5e7eb, #9ca3af);
  color: #111827;
  box-shadow: 0 3px 12px rgba(107, 114, 128, 0.4);
}

/* ---------------------------- HOMENAGEM AOS PRIMEIROS MEMBROS ---------------------------- */
/* Estático, sem animação — apenas os 30 primeiros usuários a criar conta
   recebem esse selo; os 10 primeiros ganham uma variação mais destacada. */

.profile-early-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600; font-size: 11.5px; letter-spacing: 0.02em;
  border-radius: var(--radius-full);
}
.profile-early-badge svg { width: 12px; height: 12px; }

.profile-early-badge--top10 {
  background: linear-gradient(120deg, #e5e7eb, #9ca3af);
  border: none;
  color: #111827; font-weight: 700;
  box-shadow: 0 3px 12px rgba(148, 163, 184, 0.35);
}

@media (max-width: 420px) {
  .profile-page { padding: 44px 16px 44px; }
  .profile-avatar { width: 80px; height: 80px; }
  .profile-avatar-ring { width: 88px; height: 88px; }
}
