/* ==========================================================================
   COMPANION 3D VIEW STYLES (css/companion.css)
   ========================================================================== */

#view-companion {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Unclaimed State Card (Estética orgánica blob idéntica en lenguaje a ar-permission-card) */
.unclaimed-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 360px;
  padding: 36px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  /* Blob orgánico asimétrico alternativo al de ar-permission-card */
  --br-x1: 68%;
  --br-x2: 42%;
  --br-x3: 75%;
  --br-x4: 52%;
  --br-y1: 35%;
  --br-y2: 78%;
  --br-y3: 58%;
  --br-y4: 85%;
  border-radius: var(--br-x1) var(--br-x2) var(--br-x3) var(--br-x4) / var(--br-y1) var(--br-y2) var(--br-y3) var(--br-y4);
  background: var(--primary-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--navy-dark);
  box-shadow:
    0 16px 40px -8px rgba(17, 33, 66, 0.14),
    inset 1px 1px 2px 0 rgba(255, 255, 255, 0.85),
    inset -1px -1px 3px 0 rgba(17, 33, 66, 0.1);
  z-index: 20;
  pointer-events: auto;
  will-change: transform;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
}

.unclaimed-card.hidden,
.companion-hud.hidden {
  display: none !important;
}

.unclaimed-icon-wrapper,
.unclaimed-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(107, 201, 217, 0.2);
  border: 1px solid rgba(107, 201, 217, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(107, 201, 217, 0.25);
}

.unclaimed-card h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent-2);
  margin: 0;
}

.unclaimed-card p {
  font-size: 0.9rem;
  color: var(--text-dark);
  line-height: 1.45;
  margin: 0;
}

.companion-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: max(25px, var(--sat));
  padding-bottom: calc(var(--nav-height) + max(20px, var(--sab)));
  padding-left: 16px;
  padding-right: 16px;
  pointer-events: none;
  z-index: 55; /* Prioridad superior a la hebra de navegación */
}

.view-section.active .companion-hud>* {
  pointer-events: auto;
}

.companion-controls {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-glass-circle {
  position: relative;
  width: 54px;
  height: 54px;
  /* blob */
  --br-x1: 64%;
  --br-x2: 36%;
  --br-x3: 70%;
  --br-x4: 30%;
  --br-y1: 52%;
  --br-y2: 48%;
  --br-y3: 46%;
  --br-y4: 54%;
  border-radius: var(--br-x1) var(--br-x2) var(--br-x3) var(--br-x4) / var(--br-y1) var(--br-y2) var(--br-y3) var(--br-y4);
  background: var(--bg-light);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(17, 33, 66, 0.35);
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.2s ease, background-color 0.2s ease, border-radius 0.25s ease;
  overflow: visible;
}

.btn-glass-circle svg {
  stroke: var(--navy-dark);
}

.btn-glass-circle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn-glass-circle:not(.disabled):active {
  transform: scale(0.72);
  background: #b4b4b4;
}

.circle-icon {
  font-size: 1.4rem;
}

.badge-count {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple-accent);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: 0 3px 10px rgba(17, 33, 66, 0.4), 0 0 12px rgba(66, 46, 143, 0.6);
  z-index: 25;
  pointer-events: none;
  animation: badgeCountPulse 2.2s ease-in-out infinite;
}

@keyframes badgeCountPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.badge-count.hidden {
  display: none;
}

/* Menú Desplegable Flotante de Solo Íconos (Figma Style) */
.wardrobe-dropdown-menu {
  position: absolute;
  right: 0;
  top: 64px;
  padding: 10px;
  /* blob */
  --br-x1: 20%;
  --br-x2: 30%;
  --br-x3: 22%;
  --br-x4: 38%;
  --br-y1: 28%;
  --br-y2: 12%;
  --br-y3: 40%;
  --br-y4: 10%;
  border-radius: var(--br-x1) var(--br-x2) var(--br-x3) var(--br-x4) / var(--br-y1) var(--br-y2) var(--br-y3) var(--br-y4);
  background: #F5F6FA;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow:
    0 12px 32px -4px rgba(17, 33, 66, 0.2),
    inset 1px 1px 2px 0 rgba(255, 255, 255, 0.9);
  transition: opacity 0.25s ease, transform 0.25s ease, border-radius 0.25s ease;
  z-index: 90;
  overflow: hidden;
}

.wardrobe-dropdown-menu.hidden {
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  pointer-events: none !important;
}

.outfit-icon-only-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outfit-icon-btn {
  width: 44px;
  height: 44px;
  /* blob sutil para íconos */
  --br-x1: 65%;
  --br-x2: 35%;
  --br-x3: 60%;
  --br-x4: 40%;
  --br-y1: 50%;
  --br-y2: 50%;
  --br-y3: 48%;
  --br-y4: 52%;
  border-radius: var(--br-x1) var(--br-x2) var(--br-x3) var(--br-x4) / var(--br-y1) var(--br-y2) var(--br-y3) var(--br-y4);
  background: #112142;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.outfit-icon-btn.active {
  background: var(--purple-accent);
  color: #FFFFFF;
  border-color: #FFFFFF;
  box-shadow: 0 0 12px rgba(66, 46, 143, 0.4);
}

.outfit-icon-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Selector de Kencalos en Posesión (Figma Glass Capsule)
   ========================================================================== */
.companion-top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  pointer-events: none;
  z-index: 30;
}

.kencalo-switch-capsule {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  /* blob */
  --br-x1: 66%;
  --br-x2: 34%;
  --br-x3: 60%;
  --br-x4: 40%;
  --br-y1: 42%;
  --br-y2: 58%;
  --br-y3: 50%;
  --br-y4: 50%;
  border-radius: var(--br-x1) var(--br-x2) var(--br-x3) var(--br-x4) / var(--br-y1) var(--br-y2) var(--br-y3) var(--br-y4);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 12px 30px rgba(17, 33, 66, 0.16),
    inset 1px 1px 2px rgba(255, 255, 255, 0.9);
  min-width: 250px;
  max-width: 340px;
  transition: opacity 0.3s ease, transform 0.3s ease, border-radius 0.25s ease;
  overflow: hidden;
}

.kencalo-switch-capsule.hidden {
  display: none !important;
}

.btn-switch-arrow {
  background: var(--navy-dark);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 4px 12px rgba(17, 33, 66, 0.25);
  flex-shrink: 0;
}

.btn-switch-arrow:hover:not(:disabled):not(.disabled) {
  transform: scale(1.1);
  background: var(--purple-accent);
}

.btn-switch-arrow:active:not(:disabled):not(.disabled) {
  transform: scale(0.92);
}

.btn-switch-arrow:disabled,
.btn-switch-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-switch-arrow svg {
  stroke: #FFFFFF;
}

.kencalo-current-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  flex: 1;
  user-select: none;
  overflow: hidden;
}

.kencalo-pill-name {
  font-family: var(--font-epilogue);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.kencalo-pill-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--purple-accent);
  letter-spacing: 0.4px;
}

/* Pequeño halo súper translúcido sobre el Kénkalo (desaparece al interactuar) */
.kencalo-touch-halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  margin-top: 15px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(165, 243, 252, 0.22) 0%, rgba(192, 132, 252, 0.16) 45%, rgba(99, 102, 241, 0.05) 65%, transparent 75%);
  border: 1.5px solid rgba(165, 243, 252, 0.45);
  box-shadow: 0 0 35px rgba(165, 243, 252, 0.3), inset 0 0 25px rgba(192, 132, 252, 0.2);
  pointer-events: none !important;
  z-index: 20;
  opacity: 0.92;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  animation: subtleHaloPulse 3s ease-in-out infinite;
}

.kencalo-touch-halo.halo-dismissed,
.kencalo-touch-halo.hidden {
  opacity: 0 !important;
  transform: translate(-50%, -50%) scale(0.8) !important;
  pointer-events: none !important;
}

@keyframes subtleHaloPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.92);
    box-shadow: 0 0 25px rgba(165, 243, 252, 0.25), inset 0 0 20px rgba(192, 132, 252, 0.15);
    border-color: rgba(165, 243, 252, 0.35);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 45px rgba(165, 243, 252, 0.45), inset 0 0 35px rgba(192, 132, 252, 0.3);
    border-color: rgba(165, 243, 252, 0.65);
  }
}