/* ==============================================================================
   TERINGO NEURAL COCKPIT — FRONTIER ENTERPRISE V.2026
   Arquitectura Visual: Glassmorphism 2.0 + Spatial Depth + OKLCH Lighting
   ============================================================================== */

:root {
  /* Paleta Base OKLCH de Alta Gama */
  --bg-deep: oklch(0.12 0.03 260);
  --bg-surface: oklch(0.16 0.04 260 / 0.72);
  --bg-surface-hover: oklch(0.20 0.05 260 / 0.85);
  --bg-glass-sub: oklch(0.14 0.03 260 / 0.55);
  
  /* Acentos de Lujo (Perfumery Trading) */
  --accent-gold: oklch(0.78 0.16 75);
  --accent-gold-glow: oklch(0.78 0.16 75 / 0.35);
  --accent-emerald: oklch(0.72 0.17 155);
  --accent-crimson: oklch(0.62 0.22 25);
  --accent-crimson-glow: oklch(0.62 0.22 25 / 0.45);
  --accent-indigo: oklch(0.65 0.20 280);
  
  /* Texto y Bordes */
  --text-primary: oklch(0.98 0.01 260);
  --text-secondary: oklch(0.75 0.03 260);
  --text-muted: oklch(0.55 0.03 260);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);
  
  /* Elevación y Profundidad Multicapa */
  --shadow-volumetric: 
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 12px 24px -4px rgba(0, 0, 0, 0.45),
    0 0 0 1px var(--border-subtle) inset;
    
  --shadow-glow: 0 0 35px -5px var(--accent-gold-glow);
  
  /* Tipografía */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Curvas de Transición Fluida */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Red Neuronal Canvas de Fondo */
#neuralCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

/* Luz Especular Perimetral que Sigue el Puntero */
#ambientCursorLight {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.07) 0%, rgba(99, 102, 241, 0.04) 45%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity 0.3s ease;
  will-change: left, top;
}

/* Contenedor Maestro */
.cockpit-container {
  position: relative;
  z-index: 2;
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header Espacial */
.cockpit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-volumetric);
}

.brand-zone {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-gem {
  font-size: 32px;
  filter: drop-shadow(0 0 16px var(--accent-gold-glow));
  animation: gemFloat 4s ease-in-out infinite;
}

@keyframes gemFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.04); }
}

.brand-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-title span {
  color: var(--accent-gold);
  font-weight: 400;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

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

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass-sub);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}

.telemetry-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.status-dot.pulsing {
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Grilla de Métricas en Tiempo Real */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-volumetric);
  transition: transform 0.3s var(--ease-spring), border-color 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0 2px;
  letter-spacing: -1px;
}

.metric-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.metric-trend {
  font-size: 11px;
  font-family: var(--font-mono);
}

.metric-trend.positive { color: var(--accent-emerald); }
.text-crimson { color: var(--accent-crimson); }
.text-amber { color: var(--accent-gold); }
.text-emerald { color: var(--accent-emerald); }

/* Espacio de Trabajo Principal */
.cockpit-workspace {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
}

.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  box-shadow: var(--shadow-volumetric);
  overflow: hidden;
}

.panel-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px;
  gap: 18px;
}

/* Efecto de Inclinación Espacial 3D */
.interactive-tilt {
  transform-style: preserve-3d;
  perspective: 1200px;
  transition: transform 0.15s ease-out, box-shadow 0.2s ease;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.title-icon {
  font-size: 20px;
}

.preset-pills {
  display: flex;
  gap: 6px;
}

.chip-btn {
  background: var(--bg-glass-sub);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.chip-btn.active {
  background: oklch(0.24 0.08 75 / 0.5);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  font-weight: 600;
}

/* Formularios de Entrada y Textareas Glass */
.email-input-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-row.full-grow {
  flex: 1;
}

.input-row label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.glass-input, .glass-textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 10px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-input:focus, .glass-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px -3px var(--accent-gold-glow);
}

.glass-textarea {
  resize: vertical;
  line-height: 1.5;
}

/* Badges de Triage de Frontera */
.status-badge-container {
  display: flex;
  gap: 8px;
}

.frontier-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;
  border: 1px solid transparent;
}

.badge-class {
  background: oklch(0.22 0.08 260 / 0.7);
  color: oklch(0.85 0.12 250);
  border-color: oklch(0.40 0.14 250 / 0.5);
}

.badge-priority {
  background: oklch(0.25 0.15 25 / 0.7);
  color: oklch(0.90 0.18 25);
  border-color: oklch(0.50 0.22 25 / 0.6);
  box-shadow: 0 0 12px var(--accent-crimson-glow);
  animation: pulseBadge 2.5s infinite;
}

@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 12px var(--accent-crimson-glow); }
  50% { box-shadow: 0 0 22px var(--accent-crimson-glow); }
}

/* Banner de Próxima Acción */
.action-banner {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-glass-sub);
  border-left: 4px solid var(--accent-gold);
}

.banner-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-gold);
  font-weight: 800;
  margin-bottom: 2px;
}

.banner-text {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Selector de Pestañas de Vista */
.tab-switcher {
  display: flex;
  gap: 6px;
  background: var(--bg-deep);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.view-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-tab:hover {
  color: var(--text-primary);
}

.view-tab.active {
  background: var(--bg-surface);
  color: var(--accent-gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.view-pane {
  display: none;
  flex: 1;
}

.view-pane.active {
  display: flex;
  flex-direction: column;
}

/* Área de Borrador */
.draft-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.draft-subject-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
}

.draft-subject-bar .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.glass-inline-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

.glass-inline-input:focus {
  outline: none;
}

.draft-area {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
}

/* Terminal de Razonamiento CoT (<think>) */
.thought-wrapper {
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  flex: 1;
}

.thought-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.dot.green {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

.thought-terminal {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: oklch(0.85 0.10 280);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 280px;
}

/* Memoria Few-Shot */
.memory-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.memory-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.memory-item {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.memory-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-gold);
}

.memory-item-body {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Botones de Acción */
.btn-frontier {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, oklch(0.70 0.18 75), oklch(0.55 0.18 55));
  color: #000000;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.2px;
  cursor: pointer;
  box-shadow: 0 4px 20px -2px var(--accent-gold-glow);
  transition: all 0.25s var(--ease-spring);
}

.btn-frontier:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 30px -4px var(--accent-gold-glow);
}

.btn-frontier:active {
  transform: translateY(0);
}

.btn-shortcut {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.output-action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-ghost, .btn-accent, .btn-success, .btn-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-ghost {
  background: var(--bg-glass-sub);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.btn-accent {
  background: oklch(0.30 0.12 280);
  color: oklch(0.92 0.10 280);
  border-color: oklch(0.50 0.16 280);
}

.btn-accent:hover {
  background: oklch(0.38 0.16 280);
  box-shadow: 0 0 16px oklch(0.50 0.16 280 / 0.4);
}

.btn-success {
  background: oklch(0.35 0.14 155);
  color: oklch(0.95 0.10 155);
  border-color: oklch(0.55 0.18 155);
}

.btn-success:hover {
  background: oklch(0.42 0.18 155);
  box-shadow: 0 0 16px oklch(0.55 0.18 155 / 0.4);
}

/* Historial y Auditoría */
.history-section {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.history-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.glass-input.small {
  width: 240px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-small {
  padding: 7px 12px;
  font-size: 11px;
  background: var(--bg-glass-sub);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-small:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
}

.btn-small.ghost {
  background: transparent;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.frontier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.frontier-table th {
  padding: 10px 14px;
  background: var(--bg-deep);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

.frontier-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.frontier-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

/* Toasts de Notificación */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s var(--ease-spring);
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1080px) {
  .cockpit-workspace {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
