/* ==========================================================================
   CSS Custom Properties & Themes
   ========================================================================== */

:root, [data-theme="dark-slate"] {
  --bg-primary: #080b11;
  --bg-secondary: #0f131a;
  --bg-tertiary: #191e29;
  --bg-glass: rgba(15, 19, 26, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-primary: #3b82f6;
  --accent-secondary: #6366f1;
  --accent-glow: rgba(59, 130, 246, 0.25);
  
  --btn-bg: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --btn-text: #ffffff;
  
  --canvas-nodes: #4b5563;
  --canvas-lines: rgba(75, 85, 99, 0.12);
}

[data-theme="sunset"] {
  --bg-primary: #0b0507;
  --bg-secondary: #14080e;
  --bg-tertiary: #220e17;
  --bg-glass: rgba(20, 8, 14, 0.8);
  --border-glass: rgba(244, 63, 94, 0.12);
  
  --text-primary: #ffe4e6;
  --text-secondary: #fda4af;
  --text-muted: #f43f5e;
  
  --accent-primary: #f43f5e;
  --accent-secondary: #f97316;
  --accent-glow: rgba(244, 63, 94, 0.3);
  
  --btn-bg: linear-gradient(135deg, #f43f5e 0%, #f97316 100%);
  --btn-text: #ffffff;
  
  --canvas-nodes: #f43f5e;
  --canvas-lines: rgba(244, 63, 94, 0.1);
}

[data-theme="emerald"] {
  --bg-primary: #020c07;
  --bg-secondary: #04180e;
  --bg-tertiary: #082918;
  --bg-glass: rgba(4, 24, 14, 0.8);
  --border-glass: rgba(16, 185, 129, 0.12);
  
  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-muted: #10b981;
  
  --accent-primary: #10b981;
  --accent-secondary: #06b6d4;
  --accent-glow: rgba(16, 185, 129, 0.3);
  
  --btn-bg: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --btn-text: #020c07;
  
  --canvas-nodes: #10b981;
  --canvas-lines: rgba(16, 185, 129, 0.1);
}

[data-theme="neon-blue"] {
  --bg-primary: #02050c;
  --bg-secondary: #050d1d;
  --bg-tertiary: #0a1733;
  --bg-glass: rgba(5, 13, 29, 0.8);
  --border-glass: rgba(0, 242, 254, 0.15);
  
  --text-primary: #e0f2fe;
  --text-secondary: #7dd3fc;
  --text-muted: #00f2fe;
  
  --accent-primary: #00f2fe;
  --accent-secondary: #4f46e5;
  --accent-glow: rgba(0, 242, 254, 0.35);
  
  --btn-bg: linear-gradient(135deg, #00f2fe 0%, #4f46e5 100%);
  --btn-text: #02050c;
  
  --canvas-nodes: #00f2fe;
  --canvas-lines: rgba(0, 242, 254, 0.12);
}

[data-theme="aurora"] {
  --bg-primary: #04080e;
  --bg-secondary: #08101b;
  --bg-tertiary: #101f33;
  --bg-glass: rgba(8, 16, 27, 0.8);
  --border-glass: rgba(52, 211, 153, 0.12);
  
  --text-primary: #f0fdf4;
  --text-secondary: #86efac;
  --text-muted: #34d399;
  
  --accent-primary: #34d399;
  --accent-secondary: #60a5fa;
  --accent-glow: rgba(52, 211, 153, 0.25);
  
  --btn-bg: linear-gradient(135deg, #34d399 0%, #60a5fa 100%);
  --btn-text: #04080e;
  
  --canvas-nodes: #34d399;
  --canvas-lines: rgba(52, 211, 153, 0.1);
}

[data-theme="pastel-purple"] {
  --bg-primary: #08050e;
  --bg-secondary: #100a1c;
  --bg-tertiary: #1d1233;
  --bg-glass: rgba(16, 10, 28, 0.8);
  --border-glass: rgba(192, 132, 252, 0.12);
  
  --text-primary: #faf5ff;
  --text-secondary: #d8b4fe;
  --text-muted: #c084fc;
  
  --accent-primary: #c084fc;
  --accent-secondary: #f472b6;
  --accent-glow: rgba(192, 132, 252, 0.3);
  
  --btn-bg: linear-gradient(135deg, #c084fc 0%, #f472b6 100%);
  --btn-text: #08050e;
  
  --canvas-nodes: #c084fc;
  --canvas-lines: rgba(192, 132, 252, 0.1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

body {
  font-family: 'Space Grotesk', 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  width: 100vw;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: auto;
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */

.viewport-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 20px;
}

.wizard-container {
  width: 100%;
  max-width: 580px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 50px var(--accent-glow);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

#ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(0,0,0,0) 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.75;
  transition: opacity 0.5s ease;
}

/* Header */
.wizard-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 16px;
  transform: translateZ(20px); /* 3D depth */
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-primary);
  animation: pulse 2s infinite;
}

.status-text {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.header-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Chat Area & Bubbles
   ========================================================================== */

.chat-area {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  padding-right: 6px;
  max-height: 420px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Area */
.chat-area::-webkit-scrollbar {
  width: 4px;
}
.chat-area::-webkit-scrollbar-track {
  background: transparent;
}
.chat-area::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 10px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.agent {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  background: var(--btn-bg);
  color: var(--btn-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px var(--accent-glow);
}

/* Typing Indicator Animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  display: inline-block;
}

/* ==========================================================================
   Footer Actions & Forms
   ========================================================================== */

.wizard-actions {
  border-top: 1px solid var(--border-glass);
  padding-top: 20px;
}

.action-buttons-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.action-btn::after {
  content: '→';
  opacity: 0.5;
  transform: translateX(-4px);
  transition: all 0.25s;
  color: var(--accent-primary);
  font-weight: bold;
}

.action-btn:hover {
  background: var(--border-glass);
  border-color: var(--accent-primary);
  border-left-color: var(--accent-secondary);
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.action-btn:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Forms */
.wizard-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.form-input, .form-textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 10px;
  outline: none;
  font-family: inherit;
  transition: all 0.25s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-buttons-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  flex: 1;
}

.back-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
  box-shadow: 0 4px 10px var(--accent-glow);
}

.submit-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  flex: 2;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
  opacity: 0.95;
}

.submit-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.animate-fade-in {
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animated-bubble {
  opacity: 0;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1s {
  animation-delay: 0.8s;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  45% { transform: translateY(-4px); opacity: 1; }
}

.typing-dot:nth-child(1) { animation: typingBounce 1.2s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation: typingBounce 1.2s infinite ease-in-out 0.2s; }
.typing-dot:nth-child(3) { animation: typingBounce 1.2s infinite ease-in-out 0.4s; }

/* Responsive adjustments */
@media (max-width: 480px) {
  .wizard-container {
    padding: 20px;
    max-height: 95vh;
  }
  .header-title {
    font-size: 22px;
  }
}
