/* ==================================================================
   ProfileCard - Rediseño ReactBits Holographic ID Card
   - Fondo: Foto de perfil en cover con viñeta de gradiente oscuro
   - Holográfico: Foil arcoíris reactivo al cursor, grano analógico y destellos animados
   - Tipografía: Google Sans Flex con modulación de ejes variables
   - Badges: Distinciones vectoriales limpias (sin emojis), Glow CEO especial
   ================================================================== */

.profile-card-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: profileCardOverlayFade 0.22s ease-out;
}

.profile-card-modal-overlay.closing {
  opacity: 0;
  transition: opacity 0.16s ease-out;
}

@keyframes profileCardOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Contenedor de perspectiva 3D */
.profile-card-perspective {
  position: relative;
  perspective: 1100px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 330px;
}

/* Aura Glow exterior reactiva detrás de la tarjeta */
.profile-card-behind-glow {
  position: absolute;
  inset: -28px;
  border-radius: 40px;
  background: radial-gradient(circle 240px at 50% 50%, rgba(113, 196, 255, 0.32) 0%, rgba(168, 85, 247, 0.22) 45%, transparent 75%);
  filter: blur(32px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.15s ease-out;
  will-change: transform, opacity;
}

/* Aura dorada especial para CEO */
.profile-card-perspective.is-ceo .profile-card-behind-glow {
  background: radial-gradient(circle 260px at 50% 50%, rgba(251, 191, 36, 0.45) 0%, rgba(245, 158, 11, 0.28) 40%, rgba(180, 83, 9, 0.15) 70%, transparent 85%);
  filter: blur(36px);
  opacity: 0.85;
}

.profile-card-perspective:hover .profile-card-behind-glow {
  opacity: 1;
}

/* Shell / Cuerpo principal de la tarjeta */
.profile-card-shell {
  position: relative;
  width: 100%;
  height: 450px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  color: #f8fafc;
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
  z-index: 1;
  box-sizing: border-box;
  animation: profileCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background-color: #0b1120;
}

/* Glow y borde especial para CEO */
.profile-card-shell.shell-ceo {
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.8),
    0 0 32px rgba(245, 158, 11, 0.22),
    inset 0 1px 1px rgba(253, 224, 71, 0.4),
    0 0 0 1px rgba(245, 158, 11, 0.2);
}

@keyframes profileCardPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Capa 1: Foto del usuario como fondo cover */
.profile-card-bg-cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 1;
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: saturate(1.1) brightness(0.92);
}

.profile-card-perspective:hover .profile-card-bg-cover {
  transform: scale(1.035);
}

/* Placeholder cuando el usuario no tiene foto */
.profile-card-bg-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0f172a 60%, #060913 100%);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-card-bg-initials {
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-size: 8rem;
  font-variation-settings: 'wght' 800, 'wdth' 110, 'ROND' 40;
  color: rgba(255, 255, 255, 0.04);
  user-select: none;
  pointer-events: none;
  letter-spacing: -2px;
}

/* Capa 2: Viñeta de gradiente oscuro para contraste y legibilidad */
.profile-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 11, 22, 0.72) 0%,
    rgba(7, 11, 22, 0.35) 28%,
    rgba(7, 11, 22, 0.72) 58%,
    rgba(5, 8, 17, 0.96) 84%,
    rgba(4, 6, 14, 0.99) 100%
  );
  z-index: 2;
  pointer-events: none;
}

/* Capa 3: Foil Holográfico Reactbits (iridiscente arcoíris) */
.profile-card-iridescent {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 15%,
    rgba(255, 99, 132, 0.22) 28%,
    rgba(255, 206, 86, 0.24) 40%,
    rgba(75, 192, 192, 0.22) 52%,
    rgba(54, 162, 235, 0.22) 64%,
    rgba(153, 102, 255, 0.24) 76%,
    transparent 90%
  );
  background-size: 250% 250%;
  background-position: 50% 50%;
  mix-blend-mode: color-dodge;
  opacity: 0.35;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.25s ease, background-position 0.15s ease-out;
}

.profile-card-perspective:hover .profile-card-iridescent {
  opacity: 0.75;
}

/* Capa 4: Grano / Ruido satinado físico */
.profile-card-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.85;
  z-index: 4;
  pointer-events: none;
}

/* Capa 5: Destellos animados (sparkles) */
.profile-card-sparkles {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.profile-card-sparkle {
  position: absolute;
  color: #fff;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.85));
  animation: profileSparkleFloat 3.8s ease-in-out infinite;
}

.profile-card-sparkle svg {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-card-sparkle.sp-1 {
  top: 18%;
  right: 14%;
  width: 15px;
  height: 15px;
  animation-delay: 0s;
}

.profile-card-sparkle.sp-2 {
  top: 52%;
  left: 10%;
  width: 11px;
  height: 11px;
  animation-delay: 1.2s;
  animation-duration: 4.4s;
}

.profile-card-sparkle.sp-3 {
  bottom: 24%;
  right: 18%;
  width: 13px;
  height: 13px;
  animation-delay: 2.1s;
  animation-duration: 3.2s;
}

@keyframes profileSparkleFloat {
  0%, 100% {
    transform: scale(0.6) translateY(0px) rotate(0deg);
    opacity: 0.25;
  }
  50% {
    transform: scale(1.15) translateY(-5px) rotate(25deg);
    opacity: 0.85;
  }
}

/* Capa 6: Glare especular adaptativo */
.profile-card-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
  mix-blend-mode: overlay;
}

/* Botón de cierre superior derecho */
.profile-card-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 20;
  transform: translateZ(28px);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.profile-card-close svg {
  width: 14px;
  height: 14px;
}

.profile-card-close:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
  transform: translateZ(28px) scale(1.08);
}

/* Capa de Contenido */
.profile-card-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem 1.35rem 1.4rem 1.35rem;
  box-sizing: border-box;
  transform-style: preserve-3d;
}

/* Zona superior: Distinciones e insignias en la esquina superior izquierda */
.profile-card-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  transform: translateZ(22px);
  max-width: 80%;
}

.profile-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

/* Badges estilizados sin emojis, con iconos vectoriales SVG */
.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-size: 0.68rem;
  font-variation-settings: 'wght' 680, 'wdth' 100, 'ROND' 30;
  line-height: 1.15;
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-badge .badge-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Badge especial: CEO */
.profile-badge.badge-ceo {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.38) 0%, rgba(217, 119, 6, 0.24) 100%);
  border: 1px solid rgba(251, 191, 36, 0.65);
  color: #fde047;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

/* Badge especial: Alpha Tester */
.profile-badge.badge-alpha {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.38) 0%, rgba(59, 130, 246, 0.26) 100%);
  border: 1px solid rgba(168, 85, 247, 0.6);
  color: #e9d5ff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.32);
}

/* Estado de conexión discreto */
.profile-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.68rem;
  color: #cbd5e1;
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-variation-settings: 'wght' 550, 'wdth' 98;
}

.profile-status-indicator .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-status-indicator.status-online .status-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

.profile-status-indicator.status-idle .status-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

.profile-status-indicator.status-dnd .status-dot {
  background-color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}

.profile-status-indicator.status-offline .status-dot {
  background-color: #64748b;
}

/* Zona Media: Nombre y Usuario con Google Sans Flex Variable */
.profile-card-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  transform: translateZ(26px);
  margin-top: auto;
  margin-bottom: 1.2rem;
}

.profile-card-name {
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-size: 1.55rem;
  font-variation-settings: 'wght' 780, 'wdth' 104, 'opsz' 36, 'ROND' 30;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.profile-card-handle {
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-size: 0.88rem;
  font-variation-settings: 'wght' 460, 'wdth' 96, 'opsz' 14, 'ROND' 10;
  color: #94a3b8;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Zona Inferior: Información de Membresía y Amistad */
.profile-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(10, 16, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0.75rem 0.95rem;
  transform: translateZ(20px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.profile-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.profile-meta-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-variation-settings: 'wght' 450, 'wdth' 98, 'opsz' 12;
}

.profile-meta-label .meta-icon {
  width: 13px;
  height: 13px;
  color: #64748b;
  flex-shrink: 0;
}

.profile-meta-val {
  color: #e2e8f0;
  font-family: 'Google Sans Flex', var(--font-sans), sans-serif;
  font-variation-settings: 'wght' 620, 'wdth' 100, 'opsz' 12;
  text-align: right;
  white-space: nowrap;
}

.profile-meta-val.version-badge {
  font-family: var(--font-mono, monospace);
  color: #93c5fd;
  background: rgba(91, 124, 250, 0.16);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  border: 1px solid rgba(91, 124, 250, 0.32);
  font-size: 0.72rem;
}

/* Insignias del catálogo (migración 017), mismos colores que en el chat. */
.profile-badge.badge-c-oro { background: linear-gradient(135deg, rgba(245, 158, 11, 0.38) 0%, rgba(217, 119, 6, 0.24) 100%); border: 1px solid rgba(251, 191, 36, 0.65); color: #fde047; }
.profile-badge.badge-c-violeta { background: linear-gradient(135deg, rgba(147, 51, 234, 0.38) 0%, rgba(59, 130, 246, 0.26) 100%); border: 1px solid rgba(168, 85, 247, 0.6); color: #e9d5ff; }
.profile-badge.badge-c-verde { background: linear-gradient(135deg, rgba(16, 185, 129, 0.38) 0%, rgba(5, 150, 105, 0.24) 100%); border: 1px solid rgba(52, 211, 153, 0.65); color: #a7f3d0; box-shadow: 0 0 14px rgba(16, 185, 129, 0.3); }
.profile-badge.badge-c-azul { background: rgba(91, 124, 250, 0.22); border: 1px solid rgba(143, 166, 255, 0.5); color: #c7d2fe; }
.profile-badge.badge-c-rojo { background: linear-gradient(135deg, rgba(239, 68, 68, 0.36) 0%, rgba(185, 28, 28, 0.22) 100%); border: 1px solid rgba(248, 113, 113, 0.6); color: #fecaca; }
.profile-badge.badge-c-gris { background: rgba(148, 163, 184, 0.18); border: 1px solid rgba(148, 163, 184, 0.45); color: #e2e8f0; }

/* Rango propio de un admin: degradé, borde y brillo con sus dos colores. */
.profile-badge.badge-propio {
  color: var(--rp-letra, #ffffff);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rp-fondo, #1e3a8a) 70%, #ffffff 16%) 0%,
    var(--rp-fondo, #1e3a8a) 100%);
  border: 1px solid color-mix(in srgb, var(--rp-letra, #ffffff) 60%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--rp-fondo, #1e3a8a) 60%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-shadow: 0 0 8px color-mix(in srgb, var(--rp-letra, #ffffff) 40%, transparent);
}

/* Repintar una tarjeta abierta (la persona cambió su perfil): sin volver a animar la entrada. */
.profile-card-modal-overlay.sin-animacion,
.profile-card-modal-overlay.sin-animacion * { animation: none !important; }

/* Arriba de las ventanas del medio (lista de miembros, Invitar): si no, la tarjeta quedaba atrás. */
.profile-card-modal-overlay { z-index: 3100; }

/* Botón opcional abajo de la tarjeta (0.36.4A: "Agregar a amigos"). */
.profile-card-accion {
  margin-top: 0.25rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: var(--brand-blue, #5b7cfa);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.profile-card-accion:hover:not(:disabled) {
  filter: brightness(1.1);
}
.profile-card-accion:disabled {
  cursor: default;
  opacity: 0.55;
}
