@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #0f172a;       /* Carbón arquitectónico suave */
  --accent: #2563eb;        /* Azul cobalto sereno */
  --accent-soft: #eff6ff;   /* Azul pastel tenue para selecciones */
  --border: #e2e8f0;        /* Borde gris seda ultra limpio */
  --border-focus: #93c5fd;  /* Enfoque pastel suave */
  --bg: #f8fafc;            /* Gris lino muy claro */
  --card-bg: #ffffff;       /* Blanco puro */
  --text-muted: #64748b;    /* Gris medio elegante */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg);
  color: var(--primary);
  overflow: hidden;
}

/* APP SHELL */
@keyframes initialFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.app-shell {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  opacity: 0;
  height: 100%;
  min-height: 100%;
}

.app-shell.ready {
  animation: initialFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* HEADER */
.main-header {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #0b2240;
}

.logo span {
  color: var(--accent);
}

/* STEP INDICATORS */
.step-indicators {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 20px;
}

.step-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.step-bubble.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* CONTENT */
.content {
  padding: 14px 18px 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* FOOTER */
.main-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #ffffff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

button {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
  transition: all 0.15s ease;
}

.btn-prime {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-prime:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border);
  color: #334155;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--accent);
}

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: #475569;
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* =============================================
   LOADER PREMIUM (post-login)
   ============================================= */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loader-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-logo {
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  animation: logoPulse 1.4s ease-in-out infinite;
}

.loader-logo span {
  color: var(--accent);
}

.loader-bar-track {
  width: 180px;
  height: 3px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  animation: barFill 1.4s ease-in-out infinite;
}

.loader-text {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.loader-dots::after {
  content: '';
  animation: dots 1.4s steps(3, end) infinite;
}

@keyframes logoPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(0.98);
  }
}

@keyframes barFill {
  0% {
    width: 0%;
  }

  70% {
    width: 100%;
  }

  100% {
    width: 100%;
  }
}

@keyframes dots {
  0% {
    content: '';
  }

  33% {
    content: '.';
  }

  66% {
    content: '..';
  }

  100% {
    content: '...';
  }
}

/* Fade-out del Login al transicionar al Paso 1 */
#auth-overlay {
  transition: opacity 0.25s ease;
}

/* login.css → BLINDADO (NO TOCAR)  */
/* step1.css → BLINDADO (NO TOCAR)  */
/* LIBRER�A MODAL */
.library-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.library-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.library-card {
  background: white;
  width: 90%;
  max-width: 450px;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.library-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library-header h3 {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.library-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.library-item {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s;
}

.library-item:hover {
  background: #eff6ff;
}

.library-item-icon {
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.library-item-info {
  display: flex;
  flex-direction: column;
}

.library-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.library-item-desc {
  font-size: 11px;
  color: #64748b;
}

.btn-close-lib {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
}

/* --- SPINNER DE CARGA PREMIUM --- */
.loading-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid #2563eb;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* CARPETAS DE LIBRERIA */
.lib-category-title {
  font-size: 11px;
  font-weight: 900;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 16px;
  margin-bottom: 4px;
  padding: 0 16px;
}

.lib-subcategory-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: #f8fafc;
  padding: 8px 16px;
  margin: 4px 0;
  border-left: 3px solid var(--accent);
}