/* ==========================================
   YZG STUDIO - AGENT MODE (CSS COMPLETO Y DEFINITIVO)
   ========================================== */

.agent-view {
  flex: 1;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.agent-fluid-container {
  flex: 1;
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  justify-content: center;
}

/* ==================================
   ZONA IZQUIERDA (INPUT + CHAT)
   ================================== */
.agent-left-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  max-width: 840px;
  position: relative;
  gap: 32px;
}

/* Título y Logo */
.agent-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: all 0.5s ease-out;
}

.agent-orb { width: 44px; height: 44px; filter: drop-shadow(0 0 12px rgba(99,102,241,0.5)); }
.agent-hero h1 { font-size: 36px; font-weight: 500; letter-spacing: -0.5px; color: var(--text-primary); text-align: center; margin: 0; }

/* Historial del Chat */
.agent-chat-history {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  padding: 20px 0;
  background: transparent;
  transition: all 0.5s ease;
  opacity: 0;
  pointer-events: none;
  display: none;
  scrollbar-width: none;
}
.agent-chat-history::-webkit-scrollbar { display: none; }

/* ==================================
   MEGA INPUT
   ================================== */
.mega-input-wrapper { 
  position: relative;
  width: 100%; 
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
  z-index: 10;
}

/* 🟢 El GLOW exactamente detrás */
.mega-input-glow { 
  position: absolute; 
  top: 4px; bottom: -4px; left: 0; right: 0; 
  background: linear-gradient(90deg, #6366f1, #a8c7fa, #06b6d4, #c58af9); 
  border-radius: 26px; 
  filter: blur(10px); 
  z-index: -1; 
  opacity: 0.5; 
  transition: opacity 0.3s, filter 0.3s; 
}
.mega-input-wrapper:focus-within .mega-input-glow { opacity: 0.85; filter: blur(14px); }

/* La Caja Oscura */
.mega-input-box {
  position: relative; 
  z-index: 2;
  background: rgba(20, 20, 26, 0.85); 
  backdrop-filter: blur(24px); 
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06); 
  border-radius: 20px;
  padding: 12px 18px; 
  display: flex; 
  flex-direction: column; 
  gap: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); 
  width: 100%;
}

.mega-input-top { 
  display: flex; 
  align-items: flex-start; 
  gap: 12px; 
  width: 100%; 
}

#agent-input { 
  flex: 1; 
  background: transparent; 
  border: none; 
  color: var(--text-primary); 
  font-size: 15px; 
  resize: none; 
  outline: none; 
  font-family: inherit; 
  min-height: 48px; 
  padding-top: 10px; 
  line-height: 1.5;
}

.mega-input-bottom { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  width: 100%; 
}
.mega-bottom-right { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}

/* Botones del Input */
.agent-magic-btn { 
  background: rgba(255, 255, 255, 0.04); 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  color: var(--text-primary); 
  padding: 8px 14px; 
  border-radius: 20px; 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  font-size: 12px; 
  font-weight: 500; 
  cursor: pointer; 
  transition: all 0.2s; 
}
.agent-magic-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.15); }
.agent-run-btn { border-radius: 12px; width: 40px; height: 40px; background: #fff !important; color: #000 !important; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;}
.agent-run-btn:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(255,255,255,0.2); }

/* Píldoras Rápidas */
.agent-quick-prompts { display: flex; gap: 10px; justify-content: center; width: 100%; margin-top: 24px; transition: all 0.4s ease; }
.quick-pill { background: transparent; border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text-secondary); padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: 0.2s; }
.quick-pill:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); border-color: rgba(255, 255, 255, 0.2); }

/* ==================================
   ZONA DERECHA (PREVIEW DECK)
   ================================== */
.agent-right-zone {
  flex: 1; background: #000; border: 1px solid var(--border); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.5); transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); display: none;
}
.agent-deck-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--border); }
.deck-tabs { display: flex; gap: 8px; }
.deck-tab { background: transparent; border: none; color: var(--text-secondary); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.deck-tab.active { background: var(--surface); color: var(--accent); }
.agent-deck-body { flex: 1; position: relative; }
.agent-deck-panel { position: absolute; inset: 0; background: #000; }
#agent-app-frame { width: 100%; height: 100%; border: none; display: block; }
#agent-code-viewer { width: 100%; height: 100%; background: #000; color: #a8c7fa; font-family: var(--code-font); padding: 20px; border: none; outline: none; resize: none; overflow-y: auto;}

/* ==================================
   🌟 ESTADOS MÁGICOS DE PANTALLA 🌟
   ================================== */

/* 1. IDLE (Centro) */
.state-center .agent-chat-history { display: none; }

/* 2. CHAT (Hero se va, Input baja, Historial aparece centrado) */
.state-chat { padding: 32px 40px; }
.state-chat .agent-left-zone { max-width: 840px; margin: 0 auto; height: 100%; justify-content: flex-end;}
.state-chat .agent-hero { opacity: 0; transform: translate(-50%, -100%); pointer-events: none; display: none; }
.state-chat .agent-quick-prompts { opacity: 0; pointer-events: none; display: none; }
.state-chat .mega-input-wrapper { margin-bottom: 10px; }
.state-chat .agent-chat-history { opacity: 1; display: block; pointer-events: all; }

/* 3. BUILD (Izquierda Chat, Derecha Preview) */
.state-build { padding: 24px; justify-content: flex-start; }
.state-build .agent-left-zone { width: 35%; max-width: 400px; justify-content: flex-end; gap: 16px; margin: 0; height: 100%; }
.state-build .agent-hero, .state-build .agent-quick-prompts { display: none; }
.state-build .agent-chat-history { opacity: 1; display: block; pointer-events: all; }
.state-build .agent-right-zone { display: flex; }
