/* ============================================
   DEMO SECTION - PREMIUM DESIGN
   ============================================ */
.demo-section {
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 6rem 0;
  position: relative;
}

.demo-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.section-badge-glow {
  animation: badgeGlow 2s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
  from { box-shadow: 0 0 10px var(--accent-glow); }
  to { box-shadow: 0 0 20px var(--accent-glow), 0 0 30px rgba(34, 211, 238, 0.1); }
}

.demo-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(167, 139, 250, 0.05);
}

.demo-card-header {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.1) 0%, rgba(34, 211, 238, 0.05) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.demo-method-badge {
  background: var(--cta-primary);
  color: var(--bg-primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.demo-url {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--cta-primary);
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  font-family: 'Monaco', 'Consolas', monospace;
}

.btn-demo-run {
  background: var(--gradient-accent);
  color: var(--bg-primary);
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-full);
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-base);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-demo-run:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-cta);
  color: var(--bg-primary);
}

.demo-card-body {
  padding: 1.5rem;
}

.demo-params {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.demo-params-title {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
}

.demo-field {
  margin-bottom: 1rem;
}

.demo-field:last-child {
  margin-bottom: 0;
}

.demo-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.demo-label-text {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

.demo-label-key {
  background: rgba(167, 139, 250, 0.15);
  color: var(--accent-secondary);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: monospace;
}

.demo-select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a78bfa' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.demo-select:hover {
  border-color: var(--border-hover);
}

.demo-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.demo-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem;
}

.demo-response {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.demo-response-header {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.demo-response-title {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
}

.demo-response-type {
  margin-left: auto;
  color: var(--cta-primary);
  font-size: 0.7rem;
  font-family: monospace;
  background: rgba(34, 211, 238, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

.demo-response-body {
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 1rem;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  line-height: 1.5;
  font-family: 'Monaco', 'Consolas', monospace;
}

.demo-map-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.demo-map-header {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.demo-map-title {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

.demo-map-legend {
  display: flex;
  gap: 1rem;
}

.demo-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.demo-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.demo-map {
  flex: 1;
  min-height: 400px;
}

.demo-card-footer {
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-subtle);
}

.demo-code-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1rem;
}

.demo-code-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.875rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.demo-code-tab:hover {
  color: var(--text-secondary);
}

.demo-code-tab.active {
  color: var(--accent-primary);
}

.demo-code-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
}

.demo-code-content {
  padding: 1rem 1.5rem;
}

.demo-code {
  background: transparent;
  border: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
}

.demo-code code {
  background: transparent;
  color: var(--text-secondary);
}

/* Syntax highlighting */
.code-keyword { color: #c792ea; }
.code-string { color: #c3e88d; }
.code-method { color: #82aaff; }
.code-comment { color: #637777; font-style: italic; }

/* Map popup */
.map-popup {
  font-size: 0.85rem;
  line-height: 1.5;
}

.map-popup strong {
  color: var(--accent-primary);
}

/* Leaflet customization for dark theme */
.leaflet-container {
  background: var(--bg-secondary);
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
}

.leaflet-popup-tip {
  background: var(--bg-card);
}

.leaflet-popup-content {
  margin: 0.75rem 1rem;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-tertiary) !important;
  color: var(--accent-primary) !important;
}

.leaflet-control-attribution {
  background: rgba(8, 8, 12, 0.8) !important;
  color: var(--text-dim) !important;
  font-size: 0.7rem;
}

.leaflet-control-attribution a {
  color: var(--text-muted) !important;
}

/* Responsive */
@media (max-width: 991px) {
  .demo-card-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .demo-url {
    order: 2;
    margin-top: 0.5rem;
  }
  
  .btn-demo-run {
    width: 100%;
    justify-content: center;
  }
  
  .demo-map-container {
    min-height: 350px;
    margin-top: 1.5rem;
  }
  
  .demo-map {
    min-height: 300px;
  }
}

@media (max-width: 576px) {
  .demo-section {
    padding: 4rem 0;
  }
  
  .demo-card-body {
    padding: 1rem;
  }
  
  .demo-params {
    padding: 1rem;
  }
  
  .demo-code-tabs {
    overflow-x: auto;
    padding: 0 0.5rem;
  }
  
  .demo-code-tab {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
  
  .demo-code-content {
    padding: 1rem;
  }
}
