/**
 * Kubrainn Technology & Benefits Pages
 * Styles for dedicated sub-product pages with interactive diagrams
 */

/* ===================================
   CSS Variables (inherit from root)
   =================================== */

:root {
  /* Kubrainn Brand Colors */
  --color-primary: #E10600;
  --color-primary-dark: #B30600;
  --color-bg: #0B0B0B;
  --color-surface: #121212;
  --color-surface-elevated: #1a1a1a;
  --color-text: #FFFFFF;
  --color-text-muted: #C8C8C8;
  --color-accent-cyan: #31E6FF;
  --color-success: #16a34a;
  --color-warning: #f59e0b;

  /* Neon Palette */
  --color-cyber-cyan: #31E6FF;
  --color-plasma-violet: #8B5CF6;
  --color-ion-lime: #A3E635;

  /* Gradients */
  --gradient-neon: linear-gradient(90deg, #E10600, #31E6FF, #8B5CF6);
  --gradient-surface: linear-gradient(135deg, #1a1a1a 0%, #121212 100%);

  /* Shadows and Glows */
  --glow-primary: 0 0 20px rgba(225, 6, 0, 0.5), 0 0 40px rgba(225, 6, 0, 0.3);
  --glow-cyan: 0 0 20px rgba(49, 230, 255, 0.5), 0 0 40px rgba(49, 230, 255, 0.3);
  --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ===================================
   Base Styles
   =================================== */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===================================
   Page Header - Matches Landing Page
   =================================== */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 11, 11, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 32px;
  height: 56px;
}

.site-header__left {
  display: flex;
  align-items: center;
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.3s ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand__symbol {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(49, 230, 255, 0.4));
}

.brand__word {
  font-family: Orbitron, Inter, system-ui;
  letter-spacing: 0.5px;
  font-weight: 700;
  font-size: 1.15rem;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.main-nav a {
  color: #e6f7ff;
  opacity: 0.9;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.main-nav a:hover {
  background: rgba(49, 230, 255, 0.08);
  opacity: 1;
}

.tech-header__breadcrumb {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tech-header__breadcrumb a {
  color: var(--color-accent-cyan);
  text-decoration: none;
  transition: color 0.2s;
}

.tech-header__breadcrumb a:hover {
  color: var(--color-text);
}

.tech-header__kpi {
  display: flex;
  gap: 2rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tech-header__kpi-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tech-header__kpi-value {
  font-weight: 700;
  color: var(--color-accent-cyan);
  font-size: 0.875rem;
}

/* ===================================
   Hero Section
   =================================== */

.tech-hero {
  padding: 4rem 2rem 3rem;
  background: radial-gradient(800px 600px at 50% 10%, #1a1c22 0%, #0B0B0B 50%);
  text-align: center;
}

.tech-hero__title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tech-hero__tagline {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  max-width: 800px;
  margin: 0 auto 2rem;
}

.tech-hero__engines {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.engine-badge {
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid;
  transition: all 0.3s;
}

.engine-badge--structured {
  background: rgba(49, 230, 255, 0.1);
  border-color: #31E6FF;
  color: #31E6FF;
}

.engine-badge--reasoning {
  background: rgba(139, 92, 246, 0.1);
  border-color: #8B5CF6;
  color: #8B5CF6;
}

.engine-badge--vision {
  background: rgba(163, 230, 53, 0.1);
  border-color: #A3E635;
  color: #A3E635;
}

.engine-badge--economy {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #22c55e;
}

.engine-badge--long-context {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: #f59e0b;
}

.engine-badge--dual {
  background: rgba(225, 6, 0, 0.1);
  border-color: #E10600;
  color: #E10600;
}

/* ===================================
   Navigation Tabs
   =================================== */

.tech-nav {
  background: var(--color-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 2rem;
  position: sticky;
  top: 80px;
  z-index: 90;
}

.tech-nav__tabs {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 2rem;
  list-style: none;
  overflow-x: auto;
}

.tech-nav__tab {
  position: relative;
}

.tech-nav__tab a {
  display: block;
  padding: 1rem 0;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.2s;
}

.tech-nav__tab a:hover {
  color: var(--color-text);
}

.tech-nav__tab.active a {
  color: var(--color-accent-cyan);
}

.tech-nav__tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent-cyan);
}

/* ===================================
   Main Content
   =================================== */

.tech-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.tech-section {
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tech-section__header {
  margin-bottom: 2rem;
}

.tech-section__title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.tech-section__subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* ===================================
   Cards
   =================================== */

.tech-card {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  transition: all 0.3s;
}

.tech-card:hover {
  border-color: rgba(49, 230, 255, 0.3);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), var(--glow-cyan);
}

.tech-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.tech-card__description {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ===================================
   Diagrams
   =================================== */

.diagram-container {
  background: var(--color-surface-elevated);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  position: relative;
  overflow: hidden;
}

.diagram-container__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.diagram-container__title {
  font-weight: 600;
  color: var(--color-text);
}

.diagram-container__export {
  display: flex;
  gap: 0.5rem;
}

.btn-export {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  background: rgba(49, 230, 255, 0.1);
  border: 1px solid #31E6FF;
  color: #31E6FF;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover {
  background: rgba(49, 230, 255, 0.2);
  box-shadow: var(--glow-cyan);
}

/* Mermaid diagram overrides */
.mermaid {
  background: transparent !important;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ===================================
   Interactive Widgets
   =================================== */

.widget {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.widget__header {
  margin-bottom: 1.5rem;
}

.widget__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.widget__description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.widget__controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.control-group input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow-cyan);
}

.control-group select {
  padding: 0.75rem;
  background: var(--color-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.875rem;
  cursor: pointer;
}

.control-group select:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
}

.control-value {
  font-weight: 700;
  color: var(--color-accent-cyan);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle__slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle input:checked + .toggle__slider {
  background-color: var(--color-accent-cyan);
}

.toggle input:checked + .toggle__slider:before {
  transform: translateX(24px);
}

/* Widget Output */
.widget__output {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.output-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  background: var(--color-surface-elevated);
  border-radius: 6px;
  padding: 1rem;
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--color-text-muted);
}

canvas {
  max-width: 100%;
  height: auto;
}

/* JSON Preview */
.json-preview {
  background: #000;
  border: 1px solid rgba(49, 230, 255, 0.2);
  border-radius: 6px;
  padding: 1rem;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.json-preview pre {
  margin: 0;
  color: #31E6FF;
}

/* ===================================
   Benefits Matrix
   =================================== */

.benefits-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.benefit-column {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
}

.benefit-column__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-accent-cyan);
}

.benefit-column ul {
  list-style: none;
}

.benefit-column li {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.benefit-column li:last-child {
  border-bottom: none;
}

.benefit-column li::before {
  content: '✓';
  color: var(--color-success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ===================================
   FAQ Section
   =================================== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
}

.faq-item__question {
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.faq-item__answer {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ===================================
   3D Canvas Container
   =================================== */

.canvas-3d-container {
  width: 100%;
  height: 500px;
  background: var(--color-bg);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.canvas-3d-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-3d-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

.canvas-3d-controls button {
  padding: 0.5rem;
  background: rgba(18, 18, 18, 0.9);
  border: 1px solid rgba(49, 230, 255, 0.3);
  color: var(--color-text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.canvas-3d-controls button:hover {
  background: rgba(49, 230, 255, 0.1);
  border-color: #31E6FF;
}

/* ===================================
   Mode Toggle
   =================================== */

.mode-toggle {
  display: flex;
  background: var(--color-surface-elevated);
  border-radius: 6px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.mode-toggle__btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-toggle__btn.active {
  background: var(--color-accent-cyan);
  color: #000;
}

/* ===================================
   Telemetry Panel
   =================================== */

.telemetry-panel {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.telemetry-panel__title {
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.telemetry-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.telemetry-metric__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.telemetry-metric__value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-accent-cyan);
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
  .tech-hero__title {
    font-size: 2rem;
  }

  .tech-hero__tagline {
    font-size: 1rem;
  }

  .tech-nav__tabs {
    gap: 1rem;
  }

  .widget__controls {
    grid-template-columns: 1fr;
  }

  .output-charts {
    grid-template-columns: 1fr;
  }

  .benefits-matrix {
    grid-template-columns: 1fr;
  }

  .tech-header__kpi {
    display: none;
  }

  .canvas-3d-container {
    height: 300px;
  }
}

/* ===================================
   Accessibility
   =================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .tech-section {
    opacity: 1;
    transform: none;
  }
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--color-accent-cyan);
  outline-offset: 4px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===================================
   Utility Classes
   =================================== */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-cyan { color: var(--color-accent-cyan); }

/* ===================================
   Mode Toggle & API Integration
   =================================== */

.mode-btn {
  padding: 0.5rem 1rem;
  background: rgba(49, 230, 255, 0.1);
  border: 1px solid rgba(49, 230, 255, 0.3);
  color: var(--color-text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.875rem;
  font-weight: 600;
}

.mode-btn:hover {
  background: rgba(49, 230, 255, 0.2);
  border-color: rgba(49, 230, 255, 0.5);
}

.mode-btn.active {
  background: var(--color-accent-cyan);
  color: #0B0B0B;
  border-color: var(--color-accent-cyan);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.badge-mock {
  background: rgba(139, 92, 246, 0.2);
  color: #8B5CF6;
}

.badge-live {
  background: rgba(49, 230, 255, 0.2);
  color: var(--color-accent-cyan);
}

.badge-success {
  background: rgba(163, 230, 53, 0.2);
  color: #A3E635;
}

.badge-error {
  background: rgba(225, 6, 0, 0.2);
  color: var(--color-primary);
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid rgba(49, 230, 255, 0.3);
  border-top-color: var(--color-accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-message {
  padding: 1rem;
  background: rgba(225, 6, 0, 0.1);
  border: 1px solid rgba(225, 6, 0, 0.3);
  border-radius: 6px;
  color: var(--color-primary);
}

.error-message strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.result-success pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-top: 1rem;
}

.result-success .result-meta {
  margin-bottom: 1rem;
}
