:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(20, 27, 45, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --color-primary: #6366f1; /* Indigo */
  --color-secondary: #a855f7; /* Purple */
  --color-success: #10b981; /* Emerald Green */
  --color-warning: #f59e0b; /* Amber */
  --color-danger: #ef4444; /* Rose Red */
  
  --glow-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
  --success-glow: 0 0 25px rgba(16, 185, 129, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* GRADIENT GLOW BACKGROUND BACKGROUNDS */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.bg-glow-1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -100px;
  left: -100px;
  animation: float1 15s infinite alternate;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: var(--color-secondary);
  bottom: -150px;
  right: -100px;
  animation: float2 20s infinite alternate;
}

@keyframes float1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 50px) scale(1.2); }
}

@keyframes float2 {
  0% { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-100px, -60px) scale(0.9); }
}

/* CONTAINER PRINCIPAL */
.app-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}

/* CABECERA (HEADER) */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 20px 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  color: white;
  box-shadow: var(--glow-shadow);
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* BADGE DE ESTADO GLOBAL */
.status-indicator-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* GRID DE TARJETAS (LAYOUT) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Estilo para que la consola ocupe toda la fila inferior */
.logs-card {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .logs-card {
    grid-column: span 1;
  }
  .app-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .status-indicator-badge {
    align-self: flex-start;
  }
}

/* ESTILOS DE TARJETA GLASSMORPHIC */
.dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h2 i {
  color: var(--color-primary);
}

.card-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
}

/* CONTENEDOR QR Y ÉXITO DE CONEXIÓN */
.qr-container {
  background: rgba(10, 15, 26, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  min-height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-box img {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  border: 4px solid white;
  box-shadow: var(--glow-shadow);
}

.qr-placeholder {
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.qr-placeholder i {
  color: var(--color-primary);
}

.pulse {
  animation: pulseAnim 2s infinite alternate;
}

@keyframes pulseAnim {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.08); opacity: 1; }
}

.success-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.5s ease-out;
}

.success-circle {
  background: linear-gradient(135deg, var(--color-success), #059669);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: white;
  box-shadow: var(--success-glow);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.success-box h3 {
  font-size: 20px;
  color: var(--color-success);
}

.success-box p {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.5;
}

/* DETALLES DE ESTADO */
.status-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.status-item .label {
  color: var(--text-muted);
}

.status-item .val {
  font-weight: 600;
}

.status-disconnected { color: var(--color-danger); }
.status-authenticating { color: var(--color-warning); }
.status-connected { color: var(--color-success); text-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }

.model-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

/* BOTONES DE ACCIÓN */
.actions-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.action-btn h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.action-btn p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.primary-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.primary-btn .btn-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  box-shadow: var(--glow-shadow);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.secondary-btn .btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.action-btn .btn-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.action-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.primary-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
}

.secondary-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.action-btn:hover .btn-icon {
  transform: scale(1.1) rotate(5deg);
}

/* CAJA DE INSTRUCCIONES */
.instructions-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  border-radius: 16px;
}

.instructions-box h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fbbf24;
}

.instructions-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instructions-box li {
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  padding-left: 16px;
  line-height: 1.5;
}

.instructions-box li::before {
  content: "•";
  color: var(--color-primary);
  font-weight: bold;
  position: absolute;
  left: 4px;
  top: 0;
  font-size: 14px;
}

/* CONSOLA DE LOGS EN VIVO */
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clear-logs-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.clear-logs-btn:hover {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}

.console-wrapper {
  background-color: #05070c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.console-logs {
  height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  scroll-behavior: smooth;
  padding-right: 8px;
}

/* Personalizar barra de desplazamiento */
.console-logs::-webkit-scrollbar {
  width: 6px;
}

.console-logs::-webkit-scrollbar-track {
  background: transparent;
}

.console-logs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.console-logs::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.log-entry {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  word-break: break-word;
}

.log-entry .time {
  color: #475569;
  flex-shrink: 0;
}

.log-entry .tag {
  font-weight: 600;
  flex-shrink: 0;
}

.log-entry.system { color: #38bdf8; }
.log-entry.incoming { color: #facc15; }
.log-entry.outgoing { color: #a7f3d0; }
.log-entry.tool_call { color: #c084fc; }
.log-entry.tool_response { color: #6ee7b7; }
.log-entry.error { color: #fca5a5; font-weight: 600; }
.log-entry.warning { color: #fdba74; }
.log-entry.info { color: #94a3b8; }

/* PIE DE PÁGINA (FOOTER) */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ANIMACIONES GLOBALES */
@keyframes pulsing-effect {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px currentColor; }
}

.pulsing {
  animation: pulsing-effect 1.2s infinite alternate;
}

/* ALERTAS DE ESTADO */
.error-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  animation: shake 0.5s ease-in-out;
}

.success-alert {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

