/* Reset and Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #fafafa;
  --bg-dark: #f4f4f5;
  --text: #18181b;
  --text-muted: #71717a;
  --border: #e4e4e7;
  --white: #ffffff;
  --success: #22c55e;
  --coach-bg: #f0f0ff;
  --user-bg: #6366f1;
}

html {
  font-size: 16px;
}

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

/* Progress Header */
.progress-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.progress-container {
  max-width: 800px;
  margin: 0 auto;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.step.active .step-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.step.completed .step-dot {
  background: var(--success);
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 80px;
  transition: color 0.3s ease;
}

.step.active .step-label {
  color: var(--primary);
  font-weight: 600;
}

.step.completed .step-label {
  color: var(--success);
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Chat View */
.chat-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 800px;
  margin: 0 auto;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  padding-bottom: 0;
}

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

/* Message Bubbles */
.message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

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

.message.coach {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.message.coach .message-avatar {
  background: var(--coach-bg);
}

.message.user .message-avatar {
  background: var(--user-bg);
  color: var(--white);
}

.message-content {
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  line-height: 1.5;
}

.message.coach .message-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
}

.message.user .message-content {
  background: var(--user-bg);
  color: var(--white);
  border-bottom-right-radius: 0.25rem;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
}

.typing-indicator.visible {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 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; }
.typing-dots span:nth-child(3) { animation-delay: 0; }

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

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

/* Input Container */
.input-container {
  padding: 1rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--border);
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  max-height: 150px;
  line-height: 1.5;
}

#messageInput:focus {
  border-color: var(--primary);
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.send-button:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* Completion View */
.completion-view {
  padding: 2rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.completion-view.hidden {
  display: none;
}

.completion-header {
  text-align: center;
  margin-bottom: 2rem;
}

.completion-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
}

.brand-card {
  background: var(--white);
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.brand-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand-section:last-child {
  border-bottom: none;
}

.brand-section h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.positioning-text {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.values-grid {
  display: grid;
  gap: 1rem;
}

.value-item {
  padding: 1rem;
  background: var(--bg);
  border-radius: 0.75rem;
}

.value-name {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.value-description {
  font-size: 0.9375rem;
  color: var(--text);
}

.differentiator-section p,
.anti-you-section p {
  font-size: 1rem;
  line-height: 1.7;
}

.anti-you-section {
  background: var(--bg);
}

.anti-you-section p {
  font-style: italic;
  color: var(--text-muted);
}

/* Buttons */
.completion-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.875rem 1.5rem;
  border-radius: 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .progress-header {
    padding: 0.75rem 1rem;
  }

  .step-label {
    font-size: 0.6rem;
    max-width: 60px;
  }

  .step-dot {
    width: 10px;
    height: 10px;
  }

  .chat-container {
    padding: 1rem;
  }

  .message {
    max-width: 90%;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .message-content {
    padding: 0.75rem;
    font-size: 0.9375rem;
  }

  .input-container {
    padding: 0.75rem 1rem;
  }

  .completion-view {
    padding: 1.5rem 1rem;
  }

  .completion-header h1 {
    font-size: 1.5rem;
  }

  .brand-section {
    padding: 1.25rem;
  }

  .positioning-text {
    font-size: 1.125rem;
  }

  .completion-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Hide elements when chat is complete */
.chat-view.hidden {
  display: none;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Phase transition animation */
.step.transitioning .step-dot {
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Completion view entrance animation */
.completion-view {
  animation: slideUp 0.5s ease;
}

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

/* Brand card sections stagger animation */
.brand-section {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}

.brand-section:nth-child(1) { animation-delay: 0.1s; }
.brand-section:nth-child(2) { animation-delay: 0.2s; }
.brand-section:nth-child(3) { animation-delay: 0.3s; }
.brand-section:nth-child(4) { animation-delay: 0.4s; }

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

/* Focus states for accessibility */
.btn:focus,
.send-button:focus,
#messageInput:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Smooth scrollbar */
.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Loading shimmer for completion view */
.brand-section.loading {
  background: linear-gradient(90deg, var(--bg) 25%, var(--white) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
