/* ==========================================================================
   FinanceXLab — Componentes base
   Sistema reutilizable: cards, botones, inputs, badges, barra de progreso,
   modal, toast. Depende de tokens.css. Cero valores hardcodeados.
   ========================================================================== */

/* ---- Card ---------------------------------------------------------- */

.card {
  background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-card-to) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* Cards flotantes (dropdowns/popovers con position:absolute o fixed, p.
   ej. el selector de avatar en /perfil o el panel de la calculadora
   rápida): el translateY(-3px) del hover normal las desplaza justo
   mientras el usuario tiene el mouse encima intentando hacer clic en un
   botón de adentro — el navegador cancela el click si mousedown y mouseup
   terminan en coordenadas distintas por el salto de layout a mitad de la
   interacción. Encontrado al depurar el selector de avatar, que "no
   respondía" a clics reales aunque el listener en sí estaba bien. */
.card--flotante:hover {
  transform: none;
}

/* Efecto vidrio sutil, solo en superficies fijas de un único elemento
   (topbar) — nunca en .card, que se repite decenas de veces por página y
   volvería costoso el blur (ver "sin afectar rendimiento"). */
.fxl-vidrio {
  background: rgba(15, 18, 41, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Texto con degradado violeta — logo/wordmark "FinanceXLab" y títulos que
   quieran el mismo efecto de marca. */
.text-gradient-violet {
  background: var(--gradient-violet);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Botones ---------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gradient-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.96); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secundario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.1s;
}
.btn-secundario:hover { border-color: var(--border-active); color: var(--accent-blue); }
.btn-secundario:active { transform: scale(0.96); }
.btn-secundario:disabled { opacity: 0.6; cursor: not-allowed; }

/* Teclas de la calculadora rápida flotante (js/core/calculadora.js): el
   padding horizontal normal de .btn-secundario (12px 24px) es más ancho
   que la propia columna del grid a 4 columnas dentro del panel, así que
   cada botón se salía del contenedor. min-width:0 permite que el grid las
   encoja de verdad; el padding/font-size se reducen para que quepan
   cómodas sin perder área de toque. */
.calc-tecla {
  padding: 8px 4px;
  min-width: 0;
  font-size: 0.85rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-google:hover { border-color: var(--border-active); }
.btn-google:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-google span[aria-hidden] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-blue);
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: white;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* ---- Inputs / formularios ---------------------------------------------- */

.auth-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 14px 0 6px;
}

.auth-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  margin-top: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 18px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-submit {
  width: 100%;
  margin-top: 18px;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.auth-switch a {
  color: var(--accent-blue);
  font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }

.auth-link-button {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-link-button:hover { text-decoration: underline; }

/* ---- Badge / insignia --------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.badge--activo {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}
.badge--ganada {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(34, 197, 94, 0.08);
}
.badge--bloqueada {
  color: var(--text-muted);
  filter: grayscale(1);
  opacity: 0.6;
}

/* ---- Barra de progreso -------------------------------------------------- */

.progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gradient-blue);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Modal ---------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 28px;
  max-width: 440px;
  width: 100%;
}
.modal h3 { margin-bottom: 12px; }
.modal p { margin-bottom: 18px; }
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Toast ---------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(90vw, 420px);
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.toast-close:hover { color: var(--text-primary); }

/* ---- Estados de utilidad ------------------------------------------------ */

.fxl-en-construccion {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px 20px;
}
.fxl-en-construccion p { max-width: 40ch; }

.fxl-boot-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: fxl-skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-md);
}

@keyframes fxl-skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
