/* Design System & Root Variables */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', source-code-pro, Menlo, Monaco, Consolas, monospace;

  /* Colors */
  --bg-color: #030303;
  --panel-bg: rgba(15, 15, 20, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-focus: rgba(139, 92, 246, 0.4);
  
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.15);
  --primary-gradient: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #6d28d9 100%);
  --secondary: #1f2937;
  
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.15);
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-success-border: rgba(16, 185, 129, 0.2);
  
  --color-error: #f43f5e;
  --color-error-bg: rgba(244, 63, 94, 0.1);
  --color-error-border: rgba(244, 63, 94, 0.2);
  
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.1);
  --color-info-border: rgba(59, 130, 246, 0.2);
  
  /* Layout */
  --border-radius-lg: 16px;
  --border-radius-md: 8px;
  --border-radius-sm: 6px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Premium Background Glow Effect */
.bg-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-glow::before,
.bg-glow::after {
  content: '';
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.bg-glow::before {
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: floatGlow 15s infinite alternate ease-in-out;
}

.bg-glow::after {
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
  animation: floatGlow 20s infinite alternate-reverse ease-in-out;
}

@keyframes floatGlow {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(5%, 10%) scale(1.1);
  }
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1400px;
  min-height: 90vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
  animation: pulseIcon 3s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(139, 92, 246, 0.4)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.8)); }
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #d8b4fe, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(139, 92, 246, 0.3);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Glassmorphism Panel System */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* Workspace Grid Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .app-container {
    padding: 1rem;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  height: 60vh;
  min-height: 450px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.15);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-title h2 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-main);
}

.panel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-input {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-output {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.panel-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Editor Input Area */
#graphql-input {
  width: 100%;
  height: 100%;
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 1.25rem;
  color: #e4e4e7;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

#graphql-input::placeholder {
  color: #52525b;
}

/* Output Code Styling */
.code-container {
  display: flex;
  flex-direction: column;
}

.output-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--panel-border);
}

.output-actions .btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#graphql-output-pre {
  margin: 0;
  padding: 1.25rem;
  flex: 1;
  overflow: auto;
  background: transparent !important;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

#graphql-output {
  background: transparent !important;
  text-shadow: none !important;
}

/* Customize Prism Colors to match our theme */
.token.keyword { color: #c084fc !important; font-weight: bold; }
.token.variable { color: #f43f5e !important; }
.token.string { color: #34d399 !important; }
.token.number { color: #fb7185 !important; }
.token.property, .token.attr-name { color: #38bdf8 !important; }
.token.punctuation { color: #a1a1aa !important; }
.token.comment { color: #52525b !important; font-style: italic; }
.token.definition { color: #fbbf24 !important; }

/* Custom Capsule Selector for Mode */
.toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--panel-border);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Footer / Status Bar */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.5rem;
  font-size: 0.8rem;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.status-bar.info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: #93c5fd;
}

.status-bar.success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: #6ee7b7;
}

.status-bar.error {
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
  color: #fca5a5;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.footer-stats {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(139, 92, 246, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.4);
  z-index: 999;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Tab Navigation Styles */
.header-nav {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--panel-border);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

/* Tab Content Visibility */
.tab-content {
  display: none;
  flex: 1;
}

.tab-content.active {
  display: block;
}

/* Playground / Executor Styles */
.playground-settings {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  overflow-y: auto;
}

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

.input-group.flex-1 {
  flex: 1;
  min-height: 120px;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.input-group input[type="url"],
.input-group textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group textarea {
  resize: none;
  height: 100%;
  line-height: 1.5;
}

.input-group input[type="url"]:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: rgba(0, 0, 0, 0.35);
}

/* CORS / Alert Styling */
.cors-alert {
  display: flex;
  gap: 0.75rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1.25rem;
  margin: 1.25rem 1.25rem 0 1.25rem;
  align-items: flex-start;
}

.alert-icon {
  font-size: 1.1rem;
}

.alert-text {
  font-size: 0.775rem;
  line-height: 1.5;
  color: #fde047;
}

.alert-text strong {
  color: #f59e0b;
}

#playground-response-pre {
  margin: 0;
  padding: 1.25rem;
  flex: 1;
  overflow: auto;
  background: transparent !important;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

#playground-response {
  background: transparent !important;
  text-shadow: none !important;
}
