/* ========================================
   AI GATEWAY DEMO STYLES
   ======================================== */

/* Demo Hero */
.demo-hero {
  padding: 140px 0 60px;
  background: linear-gradient(180deg, rgba(244,129,32,0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--cf-border);
}

.demo-hero-content {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.demo-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.demo-subtitle {
  font-size: 18px;
  color: var(--cf-muted);
  line-height: 1.7;
}

/* Gateway Features */
.gateway-features {
  padding: 60px 0;
  background: var(--cf-dark2);
  border-bottom: 1px solid var(--cf-border);
}

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

.feature-card {
  background: white;
  border: 1px solid var(--cf-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--cf-text);
}

.feature-card p {
  font-size: 13px;
  color: var(--cf-muted);
  line-height: 1.6;
}

/* Interactive Demo */
.interactive-demo {
  padding: 60px 0;
  background: white;
}

.demo-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

/* Chat Panel */
.chat-panel {
  background: white;
  border: 1px solid var(--cf-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  height: 600px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(244,129,32,0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--cf-border);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cf-text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-model {
  font-size: 12px;
  color: var(--cf-muted);
}

.chat-model code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 11px;
}

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

.message {
  display: flex;
  gap: 12px;
  animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cf-dark2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ai-message .message-avatar {
  background: rgba(244,129,32,0.1);
}

.message-content {
  flex: 1;
  background: var(--cf-dark2);
  padding: 14px 18px;
  border-radius: var(--radius);
  border-top-left-radius: 4px;
}

.user-message .message-content {
  background: var(--cf-orange);
  color: white;
  border-top-left-radius: var(--radius);
  border-top-right-radius: 4px;
}

.user-message .message-content p {
  color: white;
}

.message-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--cf-text);
  margin: 0;
}

.message-meta {
  display: block;
  font-size: 11px;
  color: var(--cf-muted);
  margin-top: 8px;
  opacity: 0.7;
}

.user-message .message-meta {
  color: rgba(255,255,255,0.7);
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 6px;
  padding: 8px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--cf-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--cf-border);
  background: white;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--cf-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--cf-orange);
}

.chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--cf-orange);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: var(--cf-orange-dim);
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-hint {
  font-size: 11px;
  color: var(--cf-muted);
  margin-top: 8px;
  text-align: center;
}

/* Metrics Panel */
.metrics-panel {
  background: white;
  border: 1px solid var(--cf-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  position: sticky;
  top: 80px;
}

.metrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(244,129,32,0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--cf-border);
}

.metrics-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--cf-text);
}

.live-badge {
  background: #10B981;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 100px;
  letter-spacing: 0.05em;
  animation: pulse-green 2s infinite;
}

.metrics-content {
  padding: 20px 24px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--cf-border);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  font-size: 13px;
  color: var(--cf-muted);
  font-weight: 500;
}

.metric-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--cf-text);
  font-family: 'SF Mono', Monaco, monospace;
}

.metric-value.status-active {
  color: #10B981;
}

.metric-value.cache-hit {
  color: #10B981;
  background: rgba(16,185,129,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.metric-value.cache-miss {
  color: var(--cf-orange);
  background: rgba(244,129,32,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.metric-value.request-id {
  font-size: 10px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Gateway Visual */
.gateway-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--cf-dark2);
  border-top: 1px solid var(--cf-border);
}

.gateway-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gateway-node span {
  font-size: 24px;
}

.gateway-node small {
  font-size: 10px;
  font-weight: 600;
  color: var(--cf-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gateway-arrow {
  font-size: 16px;
  color: var(--cf-muted);
  animation: arrowPulse 1.5s infinite;
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.gateway-info {
  padding: 16px 24px;
  background: white;
  border-top: 1px solid var(--cf-border);
}

.gateway-info p {
  font-size: 12px;
  color: var(--cf-muted);
  line-height: 1.6;
  margin: 0;
}

/* Code Section */
.code-section {
  padding: 80px 0;
  background: var(--cf-dark2);
  border-top: 1px solid var(--cf-border);
}

.code-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.code-block {
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.code-tag {
  background: var(--cf-orange);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.7;
  color: #a5b3ce;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.code-block code {
  font-family: inherit;
  color: #e4e4e7;
}

/* Analytics Preview */
.analytics-preview {
  padding: 24px 20px;
}

.analytics-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.analytics-item:last-child {
  margin-bottom: 0;
}

.analytics-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--cf-orange), #ff6b35);
  border-radius: 100px;
  transition: width 1s ease;
}

.analytics-item span {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

/* CTA Section */
.demo-cta {
  padding: 80px 0;
  background: linear-gradient(135deg, rgba(244,129,32,0.08) 0%, transparent 60%);
  border-top: 1px solid var(--cf-border);
}

.cta-inner {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.cta-inner h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.cta-inner p {
  font-size: 16px;
  color: var(--cf-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

.cta-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 900px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }
  
  .metrics-panel {
    position: static;
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .code-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .demo-hero {
    padding: 120px 0 40px;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-panel {
    height: 500px;
  }
  
  .gateway-visual {
    gap: 8px;
    padding: 16px;
  }
  
  .gateway-node span {
    font-size: 20px;
  }
  
  .cta-inner h2 {
    font-size: 24px;
  }
  
  .cta-actions {
    flex-direction: column;
  }
  
  .cta-actions .btn-primary,
  .cta-actions .btn-secondary {
    width: 100%;
    text-align: center;
  }
}
