/* ══════════════════════════════════════════════════════════
   VIBRACOSMOS · Galaxy Universe Explorer
   Motor de 100B digital twins como galaxia interactiva
   ══════════════════════════════════════════════════════════ */

/* ── Panel Cosmos ── */
#panelCosmos {
  position: fixed;
  inset: 0;
  background: #02010a;
  z-index: 200;
  display: none;
  flex-direction: column;
}
#panelCosmos.active {
  display: flex;
}

#cosmosCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#cosmosCanvas:active { cursor: grabbing; }

/* ── Cosmos HUD (top bar) ── */
.cosmos-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(var(--safe-top) + .75rem) 1rem .75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(to bottom, rgba(2,1,10,.9) 0%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}

.cosmos-title {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .05em;
  background: linear-gradient(135deg, #8a57ff 0%, #00d4ff 60%, #f06292 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cosmos-hud-live {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--teal);
  margin-left: auto;
}
.cosmos-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: cosmosPulse 1.4s ease-in-out infinite;
}
@keyframes cosmosPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); }
}

.cosmos-agents-hud {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(190,178,230,.5);
}

/* ── Dept Info Panel (appears on tap) ── */
.cosmos-dept-panel {
  position: absolute;
  bottom: calc(var(--safe-bot) + 5rem);
  left: 1rem; right: 1rem;
  background: rgba(16,13,26,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 1.25rem;
  padding: 1.25rem 1.25rem 1rem;
  display: none;
  animation: cosmosPanelIn .35s cubic-bezier(.34,1.56,.64,1) both;
  z-index: 20;
}
.cosmos-dept-panel.visible {
  display: block;
}
@keyframes cosmosPanelIn {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.cdp-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.cdp-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
  flex-shrink: 0;
}
.cdp-name {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 800;
  flex: 1;
}
.cdp-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .25rem;
  line-height: 1;
}

.cdp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
.cdp-stat {
  background: rgba(255,255,255,.04);
  border-radius: .75rem;
  padding: .65rem .5rem;
  text-align: center;
}
.cdp-stat-val {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: .25rem;
}
.cdp-stat-label {
  font-size: .6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.cdp-bar-wrap {
  background: rgba(255,255,255,.07);
  border-radius: 999px;
  height: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.cdp-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 1s ease;
  box-shadow: 0 0 8px currentColor;
}

.cdp-fact {
  font-size: .78rem;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: .85rem;
  font-style: italic;
}

.cdp-claim-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(138,87,255,.25), rgba(0,212,255,.15));
  border: 1px solid rgba(138,87,255,.35);
  color: var(--text);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  padding: .65rem 1rem;
  border-radius: .75rem;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .03em;
}
.cdp-claim-btn:hover, .cdp-claim-btn:active {
  background: linear-gradient(135deg, rgba(138,87,255,.4), rgba(0,212,255,.25));
  transform: translateY(-1px);
}

/* ── Zoom controls ── */
.cosmos-zoom-controls {
  position: absolute;
  right: 1rem;
  bottom: calc(var(--safe-bot) + 5rem);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 10;
}
.cosmos-zoom-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(16,13,26,.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text2);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  font-weight: 300;
}
.cosmos-zoom-btn:active {
  background: rgba(138,87,255,.3);
  color: var(--text);
}

/* ── Center dot label ── */
.cosmos-you-label {
  position: absolute;
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(255,255,255,.7);
  background: rgba(138,87,255,.25);
  border: 1px solid rgba(138,87,255,.4);
  padding: .2rem .5rem;
  border-radius: .4rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: none;
}

/* ── Mini legend ── */
.cosmos-legend {
  position: absolute;
  left: 1rem;
  bottom: calc(var(--safe-bot) + 5rem);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  z-index: 10;
  pointer-events: none;
}
.cl-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--text2);
}
.cl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Ripple effect overlay ── */
.cosmos-ripple {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  pointer-events: none;
  z-index: 5;
  animation: cosmosRipple .8s ease-out forwards;
}
@keyframes cosmosRipple {
  from { width: 0; height: 0; opacity: 1; transform: translate(-50%,-50%) scale(0); }
  to   { width: 100px; height: 100px; opacity: 0; transform: translate(-50%,-50%) scale(1); }
}

/* ── Info toast inside cosmos ── */
.cosmos-toast {
  position: absolute;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16,13,26,.9);
  border: 1px solid rgba(138,87,255,.3);
  color: var(--text);
  font-family: var(--mono);
  font-size: .72rem;
  padding: .5rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 30;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.cosmos-toast.show {
  opacity: 1;
}
