/* =====================================================================
 *  STYLE.CSS - NEXUS CORE: SENIOR AI WEB STUDIO & ARDUINO UNO R4 WiFi
 * =====================================================================
 *  Diseño responsive ultra-pulido para Desktop, Tablet y Móvil.
 * ===================================================================== */

:root {
  --bg-dark: #070a13;
  --bg-card: rgba(18, 24, 38, 0.88);
  --bg-card-hover: rgba(24, 32, 50, 0.95);
  --bg-header: rgba(11, 16, 26, 0.94);
  --bg-input: #0a0e1a;
  --bg-sidebar: #0a0f1d;
  
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --cyan-subtle: rgba(0, 240, 255, 0.12);
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.35);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.35);
  --yellow: #f59e0b;
  --red: #ef4444;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(0, 240, 255, 0.25);
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-card: 0 16px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px var(--cyan-glow);
}

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

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100%;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(0, 240, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(139, 92, 246, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* CONTENEDOR ESTÁNDAR */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

/* =====================================================================
 * HEADER MENÚ PRINCIPAL (NAVBAR)
 * ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-light);
  height: 72px;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  box-shadow: 0 0 10px var(--cyan);
}

.brand-text .cyan,
.brand-text .core-accent {
  color: var(--cyan);
  text-shadow: 0 0 14px var(--cyan-glow);
  font-weight: 800;
}

.footer-brand .core-accent {
  color: var(--cyan);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.hw-badge-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid var(--border-cyan);
  border-radius: 30px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--cyan);
  font-weight: 600;
  white-space: nowrap;
}

.dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* =====================================================================
 * HERO SECTION
 * ===================================================================== */
.hero-section {
  padding: 80px 0 50px;
  text-align: center;
  position: relative;
}

.hero-container {
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 30px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -1px;
  margin-bottom: 22px;
  color: #fff;
  word-break: break-word;
}

.gradient-text {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: clamp(14px, 3.8vw, 17px);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 34px;
  max-width: 720px;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.verify-status-banner {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 16px;
  display: inline-block;
  max-width: 100%;
}
.verify-status-banner.hidden { display: none; }
.verify-status-banner.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #86efac;
}
.verify-status-banner.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* =====================================================================
 * SECCIONES GENERALES & TELEMETRY
 * ===================================================================== */
.section {
  padding: 60px 0;
}

.section-header {
  margin-bottom: 36px;
}
.section-header.text-center {
  text-align: center;
}

.section-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}

.section-title {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}
.telemetry-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-cyan);
}

.telemetry-icon {
  font-size: 30px;
  margin-bottom: 14px;
}

.telemetry-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.telemetry-value {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  word-break: break-all;
}
.highlight-cyan { color: var(--cyan); }

.telemetry-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}
.telemetry-detail code {
  color: var(--cyan);
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.telemetry-status {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  letter-spacing: 1px;
}
.telemetry-status.green {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green);
}

/* =====================================================================
 * MATRIZ LED EN LA HOME & PREVIEW (TOTALMENTE FLUIDA Y RESPONSIVE)
 * ===================================================================== */
.matrix-card-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 40px;
  align-items: center;
}

.matrix-info {
  flex: 1;
}

.matrix-quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.matrix-interactive-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #03060c;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 2px solid #1a2234;
  max-width: 100%;
}

/* REJILLA RESPONSIVE INTELIGENTE: NO DESBORDA NUNCA */
.matrix-grid-visual {
  display: grid;
  grid-template-columns: repeat(12, min(24px, calc((100vw - 84px) / 12)));
  grid-template-rows: repeat(8, min(24px, calc((100vw - 84px) / 12)));
  gap: clamp(3px, 0.8vw, 6px);
  margin-bottom: 18px;
  justify-content: center;
}

.matrix-grid-visual.big-grid {
  grid-template-columns: repeat(12, min(30px, calc((100vw - 84px) / 12)));
  grid-template-rows: repeat(8, min(30px, calc((100vw - 84px) / 12)));
  gap: clamp(3px, 1vw, 6px);
}

.matrix-dot {
  width: 100%;
  height: 100%;
  background: #0f1626;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
  aspect-ratio: 1 / 1;
}

.matrix-dot:hover {
  background: #1e293b;
  border-color: rgba(255, 0, 60, 0.5);
}

.matrix-dot.on {
  background: #ff0040;
  box-shadow: 0 0 10px #ff0040, inset 0 0 5px #ff8099;
  border-color: #ff3366;
}

.matrix-actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* =====================================================================
 * CARACTERÍSTICAS & CTA BANNER
 * ===================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
}

.feature-icon {
  font-size: 30px;
  margin-bottom: 14px;
}

.feature-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.feature-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.feature-desc code {
  color: var(--cyan);
  font-family: var(--font-mono);
}

.cta-banner {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.cta-banner-content h3 {
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}
.cta-banner-content p {
  color: var(--text-muted);
  font-size: 14px;
}

/* =====================================================================
 * PÁGINA DEDICADA DE LOGIN (/login)
 * ===================================================================== */
.page-auth {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.auth-header {
  border-bottom: 1px solid var(--border-light);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-wrapper-spacious {
  max-width: 520px;
  width: 100%;
}

/* BANNER SUPERIOR DE CREDENCIALES */
.credentials-top-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(0, 240, 255, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.15);
}

.cred-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.cred-banner-content {
  flex: 1;
}

.cred-banner-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cred-banner-details {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.cred-banner-details code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--cyan);
  font-weight: 700;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.btn-autofill {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid var(--green);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-autofill:hover {
  background: var(--green);
  box-shadow: 0 0 16px var(--green-glow);
  transform: translateY(-1px);
}

/* ALERTA DE HARDWARE EN LOGIN */
.hw-alert-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.hw-alert-card.verified {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
}

.hw-alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fde047;
  margin-bottom: 6px;
}
.hw-alert-card.verified .hw-alert-header {
  color: #86efac;
}

.hw-alert-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.hw-alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.token-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.token-input-row.hidden { display: none; }
.token-input-row input {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* TARJETA DE LOGIN ESPACIOSA */
.login-card-spacious {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}

.card-head {
  text-align: center;
  margin-bottom: 28px;
}

.security-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--cyan);
  margin-bottom: 12px;
}

.security-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.card-title {
  font-size: clamp(22px, 5vw, 26px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.spacious-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group-spacious label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-ic {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-box input {
  width: 100%;
  padding: 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-main);
  font-size: 16px; /* Evita zoom automático en Safari iOS */
  transition: all 0.2s;
  min-height: 48px;
}

.input-box input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.eye-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
  padding: 6px;
}
.eye-toggle:hover { opacity: 1; }

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.endpoint-hint code {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 12px;
}

.feedback-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.feedback-msg.hidden { display: none; }
.feedback-msg.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.feedback-msg.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #86efac;
}

.login-card-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}

/* =====================================================================
 * PÁGINA DEL DASHBOARD (/dashboard)
 * ===================================================================== */
.page-dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height para móviles */
  overflow: hidden;
}

.dashboard-header {
  min-height: 68px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 20px;
}

.dash-top-bar {
  display: flex;
  align-items: center;
  gap: 24px;
}

.dashboard-nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dashboard-nav-tabs::-webkit-scrollbar { display: none; }

.dash-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.dash-tab-btn.active {
  background: var(--cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 16px var(--cyan-glow);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.status-indicators {
  display: flex;
  gap: 8px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  white-space: nowrap;
}
.badge-status .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-status.green { color: #86efac; border-color: rgba(16, 185, 129, 0.3); }
.badge-status.green .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.badge-status.yellow { color: #fde047; border-color: rgba(245, 158, 11, 0.3); }
.badge-status.yellow .dot { background: var(--yellow); }
.badge-status.purple { color: #d8b4fe; border-color: rgba(139, 92, 246, 0.3); }
.badge-status.purple .dot { background: var(--purple); }

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  white-space: nowrap;
}

/* ÁREA DE CONTENIDO DE PESTAÑAS */
.dashboard-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}

.dashboard-view {
  display: none;
  width: 100%;
  height: 100%;
}
.dashboard-view.active {
  display: flex;
}

/* PESTAÑA 1: CHAT WORKSPACE */
.chat-workspace-grid {
  display: flex;
  width: 100%;
  height: 100%;
}

.chat-sidebar {
  width: 300px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex-shrink: 0;
}

.sidebar-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.box-head h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-live {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--green);
}

.box-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 12px;
}

.memory-items-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.memory-item {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--cyan);
  line-height: 1.4;
}

.chips-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-chip {
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
}
.prompt-chip:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--cyan);
  color: #fff;
  transform: translateX(3px);
}

/* CHAT STREAM */
.chat-stream-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  position: relative;
  min-width: 0;
}

.chat-stream-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-msg {
  display: flex;
  gap: 14px;
  max-width: 820px;
}
.chat-msg.msg-user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.msg-user .msg-avatar {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
}
.msg-header strong { color: #fff; }
.msg-time { font-size: 11px; color: var(--text-dim); }

.msg-text {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.msg-user .msg-text {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.3);
}

.msg-text p { margin-bottom: 10px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--cyan);
  word-break: break-all;
}
.msg-text pre {
  background: #04060c;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 12px 0;
}

.ai-edit-toast {
  position: absolute;
  top: 16px;
  right: 24px;
  left: 24px;
  max-width: 440px;
  margin-left: auto;
  background: rgba(16, 185, 129, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #000;
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
  z-index: 10;
}
.ai-edit-toast.hidden { display: none; }

.chat-input-container {
  padding: 16px 32px 20px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input-container textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 16px; /* Evita zoom en Safari iOS */
  line-height: 1.4;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  transition: border-color 0.2s;
}
.chat-input-container textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.btn-send-message {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--cyan);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.btn-send-message:hover { transform: scale(1.05); }

/* PESTAÑA 2: VISTA PREVIA */
.preview-workspace {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.preview-browser-bar {
  min-height: 50px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  gap: 12px;
}

.traffic-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}
.traffic-dots .dot { width: 10px; height: 10px; border-radius: 50%; }
.traffic-dots .dot.red { background: var(--red); }
.traffic-dots .dot.yellow { background: var(--yellow); }
.traffic-dots .dot.green { background: var(--green); }

.browser-address {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 12px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.browser-device-controls {
  display: flex;
  gap: 4px;
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.device-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 700;
}

.browser-action-buttons {
  display: flex;
  gap: 8px;
}

.iframe-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #040711;
  min-height: 0;
}

.iframe-canvas-wrap iframe {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fff;
}
.iframe-canvas-wrap.tablet iframe { max-width: 768px; }
.iframe-canvas-wrap.mobile iframe { max-width: 390px; }

/* PESTAÑA 3: ARCHIVOS */
.files-workspace {
  display: flex;
  width: 100%;
  height: 100%;
}

.files-tree-panel {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 20px;
  flex-shrink: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h4 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.files-tree-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tree-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  word-break: break-all;
}
.tree-file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.tree-file-item.active {
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
  font-weight: 700;
}

.files-code-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #050812;
  min-width: 0;
}

.code-panel-head {
  height: 50px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.active-filename {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-pre-box {
  flex: 1;
  padding: 20px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
}

/* PESTAÑA 4: MATRIZ DASHBOARD */
.matrix-dashboard-layout {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 32px 24px;
  gap: 36px;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.matrix-canvas-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}
.matrix-canvas-card .card-head {
  text-align: center;
  margin-bottom: 20px;
}

.matrix-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.matrix-side-controls {
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-control-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.side-control-card h4 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cyan);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.preset-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13px;
  min-height: 42px;
}
.btn-preset:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
}

.text-scroll-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.text-scroll-form input {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-main);
  font-size: 16px;
  min-height: 46px;
}
.text-scroll-form input:focus {
  outline: none;
  border-color: var(--cyan);
}

/* =====================================================================
 * BOTONES Y HELPERS GENERALES
 * ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  min-height: 44px;
}

.btn-primary { background: var(--cyan); color: #000; }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-glow { box-shadow: 0 0 20px var(--cyan-glow); }
.btn-lg { padding: 15px 28px; font-size: 15px; border-radius: var(--radius-md); min-height: 50px; }
.btn-md { padding: 11px 18px; font-size: 13px; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 38px; }
.btn-xs { padding: 6px 12px; font-size: 12px; min-height: 34px; }
.btn-block { width: 100%; }

.btn-icon-refresh {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  padding: 4px;
}
.btn-icon-refresh:hover { opacity: 1; }

/* FOOTER GENERAL */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 32px 0;
  background: #04060c;
  margin-top: auto;
}
.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.footer-left p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.footer-right {
  display: flex;
  gap: 18px;
}
.footer-right a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
}
.footer-right a:hover { color: var(--cyan); }


/* =====================================================================
 * MEDIA QUERIES ULTRA RESPONSIVAS PARA TABLET Y MÓVIL
 * ===================================================================== */

/* TABLETS Y PANTALLAS MEDIANAS (<= 960px) */
@media (max-width: 960px) {
  .site-nav { display: none; }
  .telemetry-grid { grid-template-columns: 1fr; gap: 16px; }
  .features-grid { grid-template-columns: 1fr; gap: 16px; }
  .matrix-card-wrapper { flex-direction: column; gap: 28px; padding: 24px; }
  .chat-sidebar { display: none; }
  .matrix-dashboard-layout { flex-direction: column; align-items: center; }
  .cta-banner { flex-direction: column; text-align: center; }
  .cta-banner .btn { width: 100%; }
}

/* SMARTPHONES Y MÓVILES (<= 768px) */
@media (max-width: 768px) {
  .container { padding: 0 16px; }

  /* Navbar móvil */
  .site-header { height: 64px; }
  .header-inner { padding: 0 16px; }
  .hw-badge-mini .badge-label { display: none; }
  .hw-badge-mini { padding: 6px 10px; }
  
  /* Hero móvil */
  .hero-section { padding: 48px 0 36px; }
  .hero-badge { font-size: 10px; padding: 6px 12px; margin-bottom: 18px; text-align: center; }
  .hero-title { font-size: 28px; margin-bottom: 16px; }
  .hero-description { font-size: 14px; margin-bottom: 24px; }
  .hero-cta-group { flex-direction: column; width: 100%; gap: 12px; }
  .hero-cta-group .btn { width: 100%; }

  /* Telemetría y secciones móvil */
  .section { padding: 40px 0; }
  .section-header { margin-bottom: 24px; }
  .telemetry-card { padding: 20px; }
  .telemetry-icon { font-size: 26px; margin-bottom: 10px; }
  .telemetry-value { font-size: 16px; }

  /* Rejilla de Matriz en móvil */
  .matrix-interactive-box { padding: 14px; width: 100%; }
  .matrix-card-wrapper { padding: 20px 16px; }
  .matrix-actions-bar .btn { flex: 1; }

  /* Login en Móvil */
  .auth-main { padding: 20px 14px; }
  .credentials-top-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 16px 14px;
  }
  .cred-banner-icon { margin-bottom: 2px; }
  .cred-banner-details { font-size: 13px; }
  .credentials-top-banner .btn-autofill { width: 100%; }
  .login-card-spacious { padding: 24px 18px; }
  .card-head { margin-bottom: 20px; }
  .form-options { flex-direction: column; align-items: flex-start; gap: 10px; }
  
  /* Dashboard Header en Móvil */
  .dashboard-header {
    height: auto;
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .dash-header-left {
    justify-content: space-between;
    width: 100%;
    gap: 12px;
  }
  .dashboard-nav-tabs {
    width: 100%;
    padding: 3px;
    justify-content: flex-start;
  }
  .dash-tab-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
  .dash-header-right {
    display: none; /* Ocultar badges redundantes en móvil para ahorrar espacio vertical */
  }

  /* Chat en Móvil */
  .chat-stream-scroll {
    padding: 14px 12px;
    gap: 14px;
  }
  .chat-msg {
    gap: 10px;
    max-width: 95%;
  }
  .msg-avatar {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .msg-text {
    padding: 12px 14px;
    font-size: 13.5px;
  }
  .chat-input-container {
    padding: 10px 12px 14px;
    gap: 8px;
  }
  .chat-input-container textarea {
    padding: 10px 12px;
    min-height: 44px;
    font-size: 15px;
  }
  .btn-send-message {
    width: 44px;
    height: 44px;
  }
  .ai-edit-toast {
    right: 12px;
    left: 12px;
    top: 10px;
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Vista previa en móvil */
  .preview-browser-bar {
    padding: 6px 12px;
    flex-wrap: wrap;
  }
  .browser-device-controls { display: none; }
  .browser-address { max-width: 140px; font-size: 11px; }
  .iframe-canvas-wrap { padding: 8px; }

  /* Editor de archivos en móvil */
  .files-workspace { flex-direction: column; }
  .files-tree-panel {
    width: 100%;
    padding: 12px 14px;
    max-height: 120px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  .files-tree-list { flex-direction: row; overflow-x: auto; flex-wrap: nowrap; gap: 6px; }
  .tree-file-item { white-space: nowrap; padding: 6px 10px; font-size: 12px; }
  .code-panel-head { padding: 0 14px; height: 44px; }
  .code-pre-box { padding: 14px; font-size: 12px; }

  /* Matriz en Móvil */
  .matrix-dashboard-layout { padding: 16px 12px; gap: 20px; }
  .matrix-canvas-card { padding: 16px 12px; width: 100%; }
  .matrix-action-row { flex-direction: column; width: 100%; }
  .matrix-action-row .btn { width: 100%; }
  .side-control-card { padding: 16px; }
  .text-scroll-form .btn { width: 100%; }
}

/* SMARTPHONES MUY PEQUEÑOS (<= 380px) */
@media (max-width: 380px) {
  .site-brand .brand-text { font-size: 17px; }
  .hero-title { font-size: 24px; }
  .hero-badge { font-size: 9px; }
  .dash-tab-btn { font-size: 11px; padding: 6px 8px; }
  .dash-tab-btn span.tab-ic { margin-right: 2px; }
}
