/* ==========================================================================
 * pages/telemetria-ia.css — /telemetria_ia (Asistente de Telemetria IA)
 * --------------------------------------------------------------------------
 * LOADED BY   : src/templates/telemetria_ia.html ({% block page_css %}) — ONLY
 * NAMESPACE   : body.page-telemetria (moved out of a global :root so this
 *               page's generic var names like --primary/--background can't
 *               leak; scoped to <body> rather than a wrapper element
 *               because the original rules style `body` directly)
 * ORIGIN      : moved verbatim out of a template <style> block during the
 *               CSS centralization pass. Surface/text/background tokens
 *               were repointed to the shared brand tokens below. This
 *               page's lavender/cyan accent (--primary/--secondary) and its
 *               matching glow/border variables were deliberately LEFT AS
 *               THEIR ORIGINAL VALUES rather than repointed to brand blue:
 *               those same hex values are also hardcoded as literals in
 *               ~15 places further down this file (SVG strokes, gradient
 *               stops, the select-arrow data-URI); repointing only the
 *               named token would make the page internally inconsistent
 *               (some accents blue, most still cyan) rather than more
 *               unified. Converging this page onto the brand accent for
 *               real is exactly the kind of work css/README.md's "Dashboard
 *               pages" section flags as follow-up markup work, not a
 *               token-repoint. See css/README.md before changing this.
 * FONT        : This was the only template genuinely loading "Inter" before
 *               this refactor (from Google Fonts, alongside "Sora" for
 *               headings). Both now collapse onto the shared self-hosted
 *               --ax-font-sans (see css/README.md "Font provenance").
 * ========================================================================== */

body.page-telemetria {
  --surface: var(--ax-surface-1);
  --surface-container: var(--ax-surface-2);
  --surface-container-high: var(--ax-surface-3);
  --on-surface: var(--ax-text);
  --on-surface-variant: var(--ax-text-secondary);
  --on-primary: var(--ax-text-on-primary);
  --primary: #adc6ff;
  --secondary: #4cd7f6;
  --background: var(--ax-bg);
  --bento-bg: var(--ax-surface-glass);
  --border-glass: var(--ax-border);
  --border-cyan: rgba(76, 215, 246, 0.3);
  --glow-cyan: 0 0 10px rgba(76, 215, 246, 0.2);
  --glow-green: 0 0 10px rgba(76, 246, 120, 0.3);

  --font-sora: var(--ax-font-sans);
  --font-inter: var(--ax-font-sans);

  background-color: var(--background);
  color: var(--on-surface);
  font-family: var(--font-inter);
}

.cyber-title {
  font-family: var(--font-sora);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bento-card {
  background: var(--bento-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 1rem;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.cyber-select {
  background: #050505;
  border: 1px solid var(--border-glass);
  color: var(--on-surface);
  font-family: var(--font-inter);
  border-radius: 0.5rem;
  padding: 10px 16px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234cd7f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

.cyber-select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 8px rgba(76, 215, 246, 0.4);
}

.cyber-btn {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--on-surface-variant);
  font-family: var(--font-inter);
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.cyber-btn:hover,
.cyber-btn.telemetry-mode-active {
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: var(--glow-cyan);
}

.btn-send-cyber {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 0.5rem;
  font-family: var(--font-inter);
  font-weight: 600;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-send-cyber:hover {
  box-shadow: 0 0 15px rgba(173, 198, 255, 0.4);
  transform: translateY(-1px);
}

.car-container {
  position: relative;
  width: 100%;
  text-align: center;
  margin: 20px 0;
}

.car-container img {
  max-width: 100%;
  max-height: 400px;
  filter: drop-shadow(0 0 20px rgba(76, 215, 246, 0.3));
}

.telemetry-tag {
  position: absolute;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-cyan);
  color: var(--secondary);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-inter);
  box-shadow: var(--glow-cyan);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  z-index: 2;
}

.telemetry-tag.healthy {
  color: #4cf678;
  border-color: rgba(76, 246, 120, 0.4);
  box-shadow: var(--glow-green);
}

.telemetry-tag::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 1px;
  background: var(--secondary);
  z-index: -1;
}

.telemetry-tag.healthy::after {
  background: #4cf678;
}

@media (min-width: 768px) {
  .tag-speed {
    top: 20%;
    left: 10%;
  }

  .tag-speed::after {
    top: 50%;
    right: -30px;
    transform: rotate(20deg);
    transform-origin: left center;
    width: 60px;
  }

  .tag-engine {
    top: 40%;
    left: 5%;
  }

  .tag-engine::after {
    top: 50%;
    right: -30px;
    transform: rotate(10deg);
    width: 80px;
  }

  .tag-status {
    top: 15%;
    right: 10%;
  }

  .tag-status::after {
    top: 50%;
    left: -30px;
    transform: rotate(-15deg);
    width: 60px;
  }

  .tag-battery {
    bottom: 30%;
    right: 15%;
  }

  .tag-battery::after {
    top: 50%;
    left: -30px;
    transform: rotate(-10deg);
    width: 50px;
  }

  .tag-tire {
    bottom: 15%;
    right: 25%;
  }

  .tag-tire::after {
    top: 50%;
    left: -30px;
    transform: rotate(-25deg);
    width: 40px;
  }
}

@media (max-width: 767px) {
  .telemetry-tag {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    margin-bottom: 8px;
    display: inline-block;
  }

  .telemetry-tag::after {
    display: none;
  }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-label {
  font-size: 12px;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.metric-value-large {
  font-size: 32px;
  font-family: var(--font-sora);
  font-weight: 700;
  color: var(--secondary);
}

.metric-unit {
  font-size: 16px;
  color: var(--on-surface);
}

.progress-cyber {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-cyber-bar {
  height: 100%;
  background: var(--secondary);
  box-shadow: var(--glow-cyan);
  transition: width 0.3s;
}

.tires-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tire-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4cf678;
  font-size: 14px;
  font-weight: 600;
}

.tire-icon {
  width: 16px;
  height: 24px;
  border: 2px solid #4cf678;
  border-radius: 8px;
  position: relative;
}

.tire-icon::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  right: 4px;
  border: 1px solid rgba(76, 246, 120, 0.5);
  border-radius: 2px;
}

.chat-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 600px;
  max-height: 800px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 90%;
}

.chat-bubble.model {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.chat-bubble.user {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.chat-input-container {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.chat-input {
  flex: 1;
  background: #050505;
  border: 1px solid var(--border-glass);
  border-radius: 0.5rem;
  padding: 12px 16px;
  color: var(--on-surface);
}

.chat-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: var(--glow-cyan);
}

.telemetry-mode-pill {
  background: rgba(76, 246, 120, 0.1);
  border: 1px solid rgba(76, 246, 120, 0.3);
  color: #4cf678;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.telemetry-mode-pill.demo {
  background: rgba(76, 215, 246, 0.1);
  border-color: rgba(76, 215, 246, 0.3);
  color: var(--secondary);
}

.telemetry-mode-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
