/* ==========================================================================
   EMPRENDE IA - SISTEMA DE DISEÑO MODERNO & MINIMALISTA
   ========================================================================== */

:root {
  --bg-space: #07090e;
  --bg-surface: #0e131f;
  --bg-glass: rgba(18, 24, 38, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.6);
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.25);
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  --button-gradient: linear-gradient(135deg, #6366f1 0%, #9333ea 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-full: 9999px;
  
  --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

/* RESET GENERAL */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-space);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* RESPLANDOR AMBIENTAL */
.ambient-glow {
  position: absolute;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.glow-1 { top: -100px; left: -100px; background: #3b82f6; }
.glow-2 { bottom: -100px; right: -100px; background: #a855f7; }

/* CONTENEDOR PRINCIPAL TIPO TELÉFONO O MÓVIL EN ESCRITORIO */
.app-container {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  max-height: 920px;
  background: var(--bg-space);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

@media (min-width: 481px) {
  .app-container {
    height: 92vh;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.08);
  }
}

/* SISTEMA SPA: PANTALLAS */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

/* TEXTO GRADIENTE */
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* LOGO SVG ANIMADO */
.logo-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(14, 19, 31, 0) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 0 35px rgba(139, 92, 246, 0.25);
  animation: float 4s ease-in-out infinite;
}
.logo-circle.mini {
  width: 60px;
  height: 60px;
  margin-bottom: 12px;
}
.ai-mascot-svg {
  width: 100%;
  height: 100%;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ==========================================================================
   PANTALLA 1: SPLASH
   ========================================================================== */
#screen-splash {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
  background: radial-gradient(circle at 50% 30%, #151630 0%, var(--bg-space) 75%);
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.brand-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.45;
  margin-bottom: 45px;
}

.loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-track {
  width: 160px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.loading-bar {
  width: 40%;
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  position: absolute;
  animation: shimmer 1.8s infinite ease-in-out;
}
@keyframes shimmer {
  0% { left: -40%; }
  100% { left: 100%; }
}

.loading-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   PANTALLA 2: ACCESO
   ========================================================================== */
#screen-access {
  padding: 30px 24px;
  justify-content: center;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 15%, #151630 0%, var(--bg-space) 65%);
}

.access-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.access-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.brand-title-small {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.glass-card {
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 12px;
}

.card-instructions {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
}

.challenge-display {
  background: rgba(14, 19, 31, 0.85);
  border: 1px dashed rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.challenge-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.challenge-math {
  font-size: 1.4rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 1px;
}

/* RESET ESTRICTO DE INPUTS (ADIÓS BORDES Y FONDOS BLANCOS) */
.input-container {
  width: 100%;
  margin-bottom: 16px;
}

input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: #121826 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  outline: none;
  text-align: center;
  transition: all 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  background: #151d2f !important;
}

input[type="text"]::placeholder {
  color: #475569;
}

.btn-primary {
  width: 100%;
  background: var(--button-gradient);
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.5);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -5px rgba(139, 92, 246, 0.65);
}

.security-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 18px;
  text-align: center;
}

/* ==========================================================================
   PANTALLA 3: CHAT
   ========================================================================== */
#screen-chat {
  height: 100%;
}

.chat-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 10;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-ring {
  width: 38px;
  height: 38px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-pulse {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid var(--bg-space);
  box-shadow: 0 0 8px #10b981;
}

.header-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-model {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.online-tag {
  color: #10b981;
  font-weight: 600;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* ÁREA DE SCROLL DE MENSAJES */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* BURBUJAS DE MENSAJES */
.message-bubble {
  max-width: 86%;
  padding: 13px 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}

.message-bubble.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px 18px 18px 4px;
  color: #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message-bubble.user {
  align-self: flex-end;
  background: var(--button-gradient);
  border-radius: 18px 18px 4px 18px;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35);
}

.message-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  display: block;
  text-align: right;
  margin-top: 5px;
}

/* CAJA DE SUGERENCIAS DE PREGUNTAS */
.suggestions-box {
  background: rgba(18, 24, 38, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.suggestions-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.suggestion-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s ease;
  width: 100%;
}

.suggestion-btn span.arrow {
  color: #38bdf8;
  font-size: 0.95rem;
}

.suggestion-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateX(3px);
}

/* INDICADOR: PENSANDO... */
.typing-indicator {
  display: none;
  padding: 0 16px 8px;
  align-items: center;
}

.typing-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.typing-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounceDot 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ÁREA DE INPUT FLOTANTE */
.chat-input-wrapper {
  padding: 10px 16px;
  background: var(--bg-space);
}

.input-pill {
  display: flex;
  align-items: center;
  background: #111726;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 4px 6px 4px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.input-pill:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 25px rgba(139, 92, 246, 0.25);
}

.input-pill input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  padding: 8px 0 !important;
  text-align: left !important;
  font-size: 0.88rem !important;
  box-shadow: none !important;
}

.btn-send {
  background: var(--button-gradient);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-send:hover {
  transform: scale(1.05);
}

/* NAVEGACIÓN INFERIOR */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-glass);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn.active {
  color: #38bdf8;
}

.nav-btn:hover {
  color: var(--text-main);
}
