/* ================================================================
   EMMAFEST 28 · improvements.css
   Cargar DESPUÉS de styles.css — overrides incrementales, no destructivos.
   ================================================================ */

/* ──────────────────────────────────────────────────────────────
   [1] VARIABLE OVERRIDES — header compacto
────────────────────────────────────────────────────────────── */
:root {
  --hdr-h:       44px;    /* era 56px → -21% */
  --bnav-h:      60px;
  --bnav-pill-w: 52px;
  --bnav-pill-h: 30px;
}

/* ──────────────────────────────────────────────────────────────
   [2] HEADER COMPACTO
────────────────────────────────────────────────────────────── */
.app-header {
  height: calc(var(--hdr-h) + env(safe-area-inset-top, 0));
  padding: 0 0.875rem 0 0.65rem;
}

.hdr-wordmark        { font-size: 0.97rem; }
.hdr-logo > span:first-child { font-size: 1.15rem; }
.hdr-logo            { gap: 0.35rem; }
.hdr-coins-pill      { padding: 0.22rem 0.6rem 0.22rem 0.4rem; min-height: 30px; }
.hdr-coin-val        { font-size: 0.88rem; }
.hdr-coin-icon       { font-size: 0.78rem; }
.hdr-avatar          { width: 30px; height: 30px; border-width: 1.5px; }
.hdr-right           { gap: 0.5rem; }

/* ──────────────────────────────────────────────────────────────
   [3] BOTTOM NAV — Material 3 pill indicator
   Sin tocar el HTML. Solo CSS.
────────────────────────────────────────────────────────────── */
.bottom-nav {
  align-items: stretch;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0));
}

.bnav-btn {
  gap: 3px;
  padding: 0.45rem 0.2rem 0.35rem;
  min-height: var(--bnav-h);  /* touch target garantizado */
  /* overflow:hidden needed for pill clipping */
  overflow: hidden;
}

/* PILL INDICATOR: reemplaza la línea del top con una pastilla centrada */
.bnav-btn::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%) scale(0, 0);
  width: var(--bnav-pill-w);
  height: var(--bnav-pill-h);
  background: rgba(139, 92, 246, 0.16);
  border-radius: 999px;
  transition:
    transform  0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    opacity    0.25s ease;
  opacity: 0;
  z-index: 0;
}

.bnav-btn.active::before {
  transform: translateX(-50%) scale(1, 1);
  opacity: 1;
  background: rgba(139, 92, 246, 0.18);
}

/* ICON */
.bnav-icon {
  font-size: 1.35rem;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.bnav-btn.active .bnav-icon {
  transform: scale(1.1) translateY(-1px);
}

.bnav-btn:not(.active):hover .bnav-icon {
  transform: scale(1.06);
}

/* LABEL */
.bnav-label {
  font-size: 0.61rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: relative;
  z-index: 1;
  display: block;
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0.55;
}

.bnav-btn.active .bnav-label {
  color: var(--purple-lt);
  opacity: 1;
}

/* Active tap feedback */
.bnav-btn:active .bnav-icon {
  transform: scale(0.92);
  transition-duration: 0.1s;
}

/* ──────────────────────────────────────────────────────────────
   [4] TAB TRANSITIONS — entrada suave
────────────────────────────────────────────────────────────── */
.tab.tab-enter {
  animation: tabSlideIn 0.22s cubic-bezier(0.2, 0, 0, 1) both;
}

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

/* ──────────────────────────────────────────────────────────────
   [5] TRANSACTION LIST — layout fintech
   Sobrescribe los estilos de .tx-item y añade clases nuevas.
────────────────────────────────────────────────────────────── */

/* Reset del layout anterior */
.tx-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  column-gap: 0.7rem;
  padding: 0.78rem 0.875rem;
  align-items: center;
  border-left: none;        /* quita el borde lateral del v1 */
  border-radius: 11px;
}

/* Colores semánticos suaves por tipo */
.tx-item.in  {
  background: rgba(16, 185, 129, 0.055);
  border: 1px solid rgba(16, 185, 129, 0.16);
}
.tx-item.out {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.14);
}
.tx-item.sys {
  background: rgba(6, 182, 212, 0.045);
  border: 1px solid rgba(6, 182, 212, 0.13);
}

/* Pill de icono */
.tx-icon-pill {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  align-self: center;
}
.tx-item.in  .tx-icon-pill { background: rgba(16, 185, 129, 0.15); }
.tx-item.out .tx-icon-pill { background: rgba(239, 68, 68, 0.13); }
.tx-item.sys .tx-icon-pill { background: rgba(6, 182, 212, 0.12); }

/* Contenido en dos filas */
.tx-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tx-top,
.tx-bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.tx-action {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-time-label {
  font-size: 0.68rem;
  color: var(--txt-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.tx-sub {
  font-size: 0.74rem;
  color: var(--txt-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 0.98rem;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.tx-amount.pos { color: var(--green-lt); }
.tx-amount.neg { color: var(--red-lt); }
.tx-amount.neu { color: var(--cyan); }

/* ──────────────────────────────────────────────────────────────
   [6] ACTIVITY FEED — sección nueva
────────────────────────────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.act-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.68rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  animation: actEnter 0.3s cubic-bezier(0.2, 0, 0, 1) both;
}

/* Acento lateral semántico */
.act-item.act-blue   { border-left: 2px solid rgba(99, 102, 241, 0.55); }
.act-item.act-gold   { border-left: 2px solid rgba(245, 158, 11, 0.55); }
.act-item.act-purple { border-left: 2px solid rgba(139, 92, 246, 0.55); }
.act-item.act-green  { border-left: 2px solid rgba(16, 185, 129, 0.55); }

.act-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.06rem;
  line-height: 1;
}

.act-body  { flex: 1; min-width: 0; }

.act-text {
  font-size: 0.82rem;
  color: var(--txt-2);
  line-height: 1.42;
  display: block;
  margin-bottom: 0.18rem;
}
.act-text strong { color: var(--txt); font-weight: 700; }
.act-text em     { color: var(--purple-lt); font-style: normal; }

.act-time {
  font-size: 0.67rem;
  color: var(--txt-3);
  display: block;
}

@keyframes actEnter {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ──────────────────────────────────────────────────────────────
   [7] COIN COUNTER — microinteracciones
────────────────────────────────────────────────────────────── */
.hero-coin-num {
  font-variant-numeric: tabular-nums;
  will-change: contents;
}

/* Flash de color según dirección del cambio */
.hero-coin-num.going-up {
  animation: flashUp 0.55s ease both;
}
.hero-coin-num.going-down {
  animation: flashDown 0.55s ease both;
}

@keyframes flashUp {
  0%   { color: var(--gold-lt); }
  35%  { color: var(--green-lt); }
  100% { color: var(--gold-lt); }
}
@keyframes flashDown {
  0%   { color: var(--gold-lt); }
  35%  { color: var(--red-lt); }
  100% { color: var(--gold-lt); }
}

/* Rank badge pulse cuando sube */
.hero-rank-badge.pulse-up {
  animation: rankPulse 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes rankPulse {
  0%   { transform: scale(1); border-color: rgba(139,92,246,0.35); }
  45%  { transform: scale(1.22); border-color: rgba(16,185,129,0.6); color: var(--green-lt); background: rgba(16,185,129,0.15); }
  100% { transform: scale(1); }
}

/* ──────────────────────────────────────────────────────────────
   [8] MOBILE SPACING — ajustes táctiles
────────────────────────────────────────────────────────────── */
.tab {
  padding-left:  0.875rem;
  padding-right: 0.875rem;
  padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0) + 1.25rem);
}

/* Touch targets mínimo 48px */
.quick-btn     { min-height: 44px; }
.field         { min-height: 48px; }
.picker-item   { min-height: 52px; }
.picker-trigger { min-height: 48px; }

/* Leaderboard rows más compactos */
.lb-row { padding: 0.62rem 0.875rem; }

/* Cards ligeramente más tight en mobile */
.card       { padding: 0.95rem 1rem; }
.hero-card  { padding: 1.1rem 1.1rem 0.875rem; }

/* Lb avatar ligeramente más pequeño */
.lb-avatar  { width: 32px; height: 32px; }

/* ──────────────────────────────────────────────────────────────
   [9] RESPONSIVE — tablet centering (igual que antes)
────────────────────────────────────────────────────────────── */
@media (min-width: 480px) {
  .tab { padding-left: 1.1rem; padding-right: 1.1rem; }
}

@media (min-width: 768px) {
  .tab {
    max-width: 640px;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
  }
}
/* La card ahora es columna para acomodar el panel de detalles */
.game-card {
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Header clickeable (la fila superior existente) */
.game-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Chevron › rotado cuando está abierto */
.game-chevron {
  font-size: 1.2rem;
  color: var(--txt-3);
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1),
              color    0.2s ease;
}

.game-card.expanded .game-chevron {
  transform: rotate(90deg);
  color: var(--purple-lt);
}

/* Panel de detalles — animación max-height */
.game-details {
  display: grid;
  grid-template-rows: 0fr;           /* colapso nativo con grid */
  transition: grid-template-rows 0.28s cubic-bezier(0.2, 0, 0, 1),
              opacity             0.22s ease;
  opacity: 0;
}

.game-card.expanded .game-details {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* Wrapper interno necesario para el truco grid 0fr→1fr */
.game-details-inner {
  overflow: hidden;
  padding-top: 0;
  transition: padding-top 0.22s ease;
}

.game-card.expanded .game-details-inner {
  padding-top: 0.75rem;
}

/* Texto de descripción */
.game-description {
  font-size: 0.84rem;
  color: var(--txt-2);
  line-height: 1.52;
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
  margin: 0;
  white-space: pre-line; /* respeta saltos de línea del admin */
}

.game-no-desc {
  font-size: 0.8rem;
  color: var(--txt-3);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
  margin: 0;
}

/* Feedback visual al hacer tap */
.game-card:active {
  background: var(--bg-card2);
  transition: background 0.08s;
}

