/* ============================================
   Dr. Amara Osei — Nutrition PWA
   Design System: Lovable/MiniMax Warm Wellness
   ============================================ */

:root {
  /* Primary — Moss Green */
  --color-primary: #55A493;
  --color-primary-dark: #2D5016;
  --color-primary-light: #7BC4B0;
  
  /* Secondary — Warm Cream */
  --color-secondary: #F5F1EB;
  --color-secondary-dark: #E8DFD3;
  
  /* Accent — Terracotta */
  --color-accent: #D4776B;
  --color-accent-light: #E8A098;
  
  /* Neutrals */
  --color-bg: #FDFAF6;
  --color-bg-card: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-muted: #6B6B6B;
  --color-border: #E5E0D8;
  
  /* Semantic */
  --color-success: #4A7C23;
  --color-error: #C44A3A;
  
  /* Typography */
  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-lg);
}

/* ============================================
   Header
   ============================================ */
.header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--color-primary-light);
}

.avatar-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--color-bg);
}

.header-text {
  flex: 1;
  min-width: 0;
}

.header-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: 2px;
}

.header-tagline {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ============================================
   Trust Signals
   ============================================ */
.trust-signals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.trust-item {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: var(--color-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.hero-headline {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.2;
}

.hero-subtext {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  max-width: 280px;
}

.hero-micro {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 14px rgba(85, 164, 147, 0.35);
  width: 100%;
  max-width: 320px;
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(85, 164, 147, 0.45);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-full {
  width: 100%;
  max-width: none;
}

.btn-icon {
  font-size: 1.2rem;
}

.btn-send {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

/* ============================================
   Accordion
   ============================================ */
.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.accordion-item {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  transition: background var(--transition-fast);
}

.accordion-header:hover {
  background: var(--color-secondary);
}

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

.accordion-label {
  flex: 1;
}

.accordion-arrow {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-base);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 0 var(--space-lg) var(--space-lg);
  animation: slideDown 0.3s ease;
}

.accordion-item.open .accordion-content {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Chat
   ============================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-chat {
  max-height: 60vh;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 350px;
  overflow-y: auto;
  padding-right: var(--space-sm);
  -webkit-overflow-scrolling: touch;
}

.chat-welcome {
  background: var(--color-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-welcome p {
  margin-bottom: var(--space-sm);
}

.chat-welcome p:last-child {
  margin-bottom: 0;
}

.chat-message {
  display: flex;
  gap: var(--space-sm);
  animation: fadeIn 0.2s ease;
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-bubble {
  max-width: 80%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.ai .chat-bubble {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
  align-self: flex-end;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--color-text-muted);
  border-radius: var(--radius-full);
  animation: bounce 1.2s ease infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.chat-input-area {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--color-secondary);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(85, 164, 147, 0.15);
  background: var(--color-bg-card);
}

.email-note {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-xs);
}

/* ============================================
   Booking Form
   ============================================ */
.booking-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.booking-intro {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--color-secondary);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(85, 164, 147, 0.15);
  background: var(--color-bg-card);
}

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

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Booking Success */
.booking-success {
  text-align: center;
  padding: var(--space-xl);
  animation: fadeIn 0.3s ease;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: var(--color-success);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto var(--space-md);
}

.booking-success h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-sm);
}

.booking-success p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.success-detail {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--color-secondary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-xl);
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  background: var(--color-secondary);
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-secondary-dark);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-right: 40px;
}

.modal-emoji {
  font-size: 1.5rem;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--color-primary-dark);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-lg);
}

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

.footer-note {
  margin-top: var(--space-xs);
  opacity: 0.6;
  font-size: 0.7rem !important;
}

/* ============================================
   Offline Toast
   ============================================ */
.offline-toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   Utility
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 380px) {
  #app {
    padding: var(--space-md);
  }
  
  .hero-section {
    padding: var(--space-lg);
  }
  
  .hero-headline {
    font-size: 1.5rem;
  }
  
  .header-name {
    font-size: 1.15rem;
  }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 4px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* ============================================
   PWA Install Banner
   ============================================ */
.install-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  text-align: center;
  font-size: 0.85rem;
}

.install-banner button {
  background: white;
  color: var(--color-primary-dark);
  border: none;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: var(--space-sm);
}
