/* ═══════════════════════════════════════════════════════
   PERFIL WIDGET FLUTUANTE — perfil.css
   Widget flutuante de perfil partilhado por todas as páginas.
   Importar nas páginas via <link rel="stylesheet" href="perfil.css">
═══════════════════════════════════════════════════════ */

/* ─── BOTÃO FLUTUANTE ─────────────────────────────── */

.perfil-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 8000;
  user-select: none;
  touch-action: none;
}

.perfil-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--p, #8b5cf6);
  border: 2.5px solid rgba(167, 139, 250, 0.6);
  box-shadow:
    0 4px 20px rgba(139, 92, 246, 0.55),
    0 0 0 0 rgba(139, 92, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: perfilPulse 3s ease-in-out infinite;
}

@keyframes perfilPulse {
  0%   { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.55), 0 0 0 0   rgba(139, 92, 246, 0.35); }
  50%  { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.55), 0 0 0 8px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.55), 0 0 0 0   rgba(139, 92, 246, 0); }
}

.perfil-btn:hover {
  transform: scale(1.1);
  border-color: var(--p3, #a78bfa);
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.7);
  animation: none;
}

.perfil-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}

/* Estado a arrastar */
.perfil-widget.dragging .perfil-btn {
  transform: scale(1.12);
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.7);
  animation: none;
}

/* ─── PAINEL ─────────────────────────────────────── */

.perfil-painel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 320px;
  background: #111115;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.75),
    0 0 40px rgba(109, 40, 217, 0.2);
  z-index: 8001;
  overflow: hidden;
  animation: painelIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

@keyframes painelIn {
  from { opacity: 0; transform: scale(0.85) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* HEADER DO PAINEL */
.perfil-painel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
  background: rgba(139, 92, 246, 0.04);
}

.perfil-painel-titulo {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #f0f0f5;
  letter-spacing: -0.2px;
}

.perfil-fechar {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: #7c7c90;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  line-height: 1;
  padding: 0;
}

.perfil-fechar:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #f0f0f5;
  border-color: rgba(139, 92, 246, 0.3);
}

/* ÁREA DO AVATAR */
.perfil-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 16px;
  gap: 10px;
  background: linear-gradient(180deg, rgba(109, 40, 217, 0.08) 0%, transparent 100%);
}

.perfil-avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.perfil-avatar-wrap:hover {
  border-color: #8b5cf6;
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.5);
}

.perfil-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.perfil-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 16px;
  color: white;
}

.perfil-avatar-wrap:hover .perfil-avatar-overlay { opacity: 1; }

.perfil-nome-display {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #f0f0f5;
  text-align: center;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── TABS ─────────────────────────────────────────── */

.perfil-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 12px;
}

.perfil-tab {
  flex: 1;
  padding: 7px 8px;
  border: none;
  background: transparent;
  color: #7c7c90;
  font-family: 'Syne', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.2px;
}

.perfil-tab:hover {
  background: rgba(139, 92, 246, 0.1);
  color: #f0f0f5;
}

.perfil-tab.ativo {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* ─── CONTEÚDO DAS TABS ─────────────────────────────── */

.perfil-tab-content { display: none; padding: 0 14px 14px; }
.perfil-tab-content.ativo { display: block; }

/* ─── CAMPOS ────────────────────────────────────────── */

.perfil-campo { margin-bottom: 12px; }

.perfil-campo label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: #7c7c90;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 5px;
  font-family: 'Syne', sans-serif;
}

.perfil-input-wrap { display: flex; gap: 6px; }

.perfil-input-wrap input,
.amigos-adicionar input {
  flex: 1;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #f0f0f5;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.perfil-input-wrap input:focus,
.amigos-adicionar input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.perfil-guardar-btn,
.amigos-adicionar button {
  padding: 9px 13px;
  background: #8b5cf6;
  border: none;
  border-radius: 8px;
  color: white;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(139, 92, 246, 0.35);
  flex-shrink: 0;
}

.perfil-guardar-btn:hover,
.amigos-adicionar button:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.perfil-email-display {
  font-size: 13px;
  color: #5a5a6e;
  padding: 2px 0;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── LOGOUT ─────────────────────────────────────────── */

.perfil-logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: #f87171;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.perfil-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

/* ─── AMIGOS ─────────────────────────────────────────── */

.amigos-adicionar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.amigos-lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #8b5cf6 transparent;
}

.amigos-lista::-webkit-scrollbar { width: 3px; }
.amigos-lista::-webkit-scrollbar-thumb { background: #8b5cf6; border-radius: 4px; }

.amigo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  transition: border-color 0.2s, background 0.2s;
}

.amigo-item:hover {
  border-color: rgba(139, 92, 246, 0.2);
  background: rgba(139, 92, 246, 0.06);
}

.amigo-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.amigo-nome {
  flex: 1;
  font-size: 13px;
  color: #f0f0f5;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amigo-remover {
  background: none;
  border: none;
  color: #4a4a5a;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 5px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.amigo-remover:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.amigos-vazio {
  font-size: 12px;
  color: #4a4a5a;
  text-align: center;
  padding: 16px 0;
  font-family: 'DM Sans', sans-serif;
}

/* ─── RESPONSIVO ─────────────────────────────────────── */

@media (max-width: 480px) {
  .perfil-painel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 80px;
  }

  .perfil-widget {
    bottom: 20px;
    right: 20px;
  }
}
