/* ============================================================
   Ruby Care — Design Tokens (from rc-tokens.css)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,500&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces */
  --rc-paper:        #FAF8F5;
  --rc-canvas:       #F4F2EF;
  --rc-card:         #FFFFFF;
  --rc-line:         #E7E3DD;
  --rc-line-strong:  #D4CEC4;
  --rc-ink:          #0E0F10;
  --rc-ink-soft:     #1A1B1D;
  --rc-ink-line:     #2A2C2F;

  /* Foreground on light */
  --rc-fg:           #15171A;
  --rc-fg-2:         #3D3E42;
  --rc-fg-3:         #6B6A66;
  --rc-fg-4:         #94928D;

  /* Foreground on dark */
  --rc-fg-on-ink:    #F4F2EF;
  --rc-fg-on-ink-2:  #B8B5B0;
  --rc-fg-on-ink-3:  #807D78;

  /* Plum */
  --rc-plum:         #4A2348;
  --rc-plum-deep:    #321831;
  --rc-plum-soft:    #E5D6E3;
  --rc-plum-wash:    #F5EDF4;

  /* Butter */
  --rc-butter:       #F2D479;
  --rc-butter-deep:  #D9B855;
  --rc-butter-soft:  #FBF1D2;

  /* Cobalt */
  --rc-cobalt:       #5B5BFF;
  --rc-cobalt-deep:  #3F3FE0;
  --rc-cobalt-soft:  #DDDDFF;
  --rc-cobalt-wash:  #EFEFFF;

  /* WhatsApp */
  --wa-green:        #25D366;
  --wa-green-deep:   #1FB855;

  /* Type */
  --rc-font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --rc-font-body:    "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --rc-font-mono:    "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --rc-r-sm: 10px;
  --rc-r-md: 14px;
  --rc-r-lg: 20px;
  --rc-r-xl: 28px;
  --rc-r-2xl: 40px;
  --rc-r-pill: 999px;

  /* Motion */
  --rc-ease-standard: cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --rc-dur-base: 220ms;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--rc-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--rc-canvas);
  color: var(--rc-fg);
  min-height: 100dvh;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   PAGE LAYOUT
   On mobile: full viewport.
   On desktop: centered phone-like artboard with soft bg.
   ============================================================ */
.screen {
  background: var(--rc-paper);
  color: var(--rc-fg);
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

@media (min-width: 480px) {
  body {
    background: linear-gradient(135deg, #2a2a30 0%, #1a1a1c 100%);
    padding: 24px;
  }
  .screen {
    max-width: 420px;
    min-height: auto;
    height: min(880px, calc(100dvh - 48px));
    border-radius: 32px;
    box-shadow: 0 40px 80px -24px rgba(0,0,0,0.4),
                0 12px 24px -8px rgba(0,0,0,0.2);
  }
}

/* ============================================================
   BRAND ROW
   ============================================================ */
.brand-row {
  padding: 20px 24px 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.brand-row img { height: 30px; width: auto; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 16px 24px 0;
  flex-shrink: 0;
}
.headline {
  font-family: var(--rc-font-display);
  font-weight: 400;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--rc-fg);
  text-wrap: balance;
  margin: 0;
  font-optical-sizing: auto;
}
.headline em {
  font-style: italic;
  color: var(--rc-cobalt);
}
.subline {
  font-size: 15px;
  line-height: 1.45;
  color: var(--rc-fg-2);
  margin: 12px 0 0;
}

/* ============================================================
   CHAT PREVIEW
   ============================================================ */
.chat-preview {
  margin: 20px 20px 0;
  background: #fff;
  border-radius: var(--rc-r-xl);
  border: 1px solid var(--rc-line);
  overflow: hidden;
  flex-shrink: 0;
}
.chat-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--rc-line);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--rc-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rc-cobalt-soft);
  flex-shrink: 0;
}
.avatar img { height: 18px; width: auto; }
.agent-info { flex: 1; min-width: 0; }
.agent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--rc-fg);
}
.agent-status {
  font-size: 11.5px;
  color: var(--rc-fg-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.agent-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wa-green);
  display: inline-block;
}
.chat-body {
  padding: 16px 16px 14px;
  background: var(--rc-paper);
  min-height: 130px;
}

.bot-message {
  background: #fff;
  border: 1px solid var(--rc-line);
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  font-size: 14px;
  color: var(--rc-fg);
  max-width: 82%;
  line-height: 1.4;
  white-space: pre-line;
  min-height: 22px;
}
.bot-message .caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  vertical-align: -2px;
  background: var(--rc-fg);
  margin-left: 2px;
  animation: rc-caret 1s infinite step-end;
}

.typing-dots {
  background: #fff;
  border: 1px solid var(--rc-line);
  padding: 12px 14px;
  border-radius: 16px 16px 16px 4px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rc-fg-4);
  animation: rc-typing 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

.chips {
  margin-top: 10px;
  min-height: 32px;
  opacity: 0;
  transition: opacity 320ms var(--rc-ease-standard);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips.visible { opacity: 1; }
.chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--rc-line);
  color: var(--rc-fg-2);
  font-weight: 400;
  animation: rc-chip-in 360ms var(--rc-ease-standard) both;
}
.chip:nth-child(1) { animation-delay: 0ms; }
.chip:nth-child(2) { animation-delay: 55ms; }
.chip:nth-child(3) { animation-delay: 110ms; }
.chip:nth-child(4) { animation-delay: 165ms; }
.chip:nth-child(5) { animation-delay: 220ms; }
.chip:nth-child(6) { animation-delay: 275ms; }

/* ============================================================
   TRUST PILLS
   ============================================================ */
.trust-pills {
  padding: 16px 20px 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}
.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.pill-cobalt { background: var(--rc-cobalt-soft); color: var(--rc-cobalt-deep); }
.pill-butter { background: var(--rc-butter-soft); color: var(--rc-fg); }
.pill-plum   { background: var(--rc-plum-soft);   color: var(--rc-plum-deep); }

/* ============================================================
   SPACER + CTA
   ============================================================ */
.spacer { flex: 1; min-height: 4px; }

.cta-area {
  padding: 12px 20px 28px;
  flex-shrink: 0;
}
.cta {
  display: block;
  background: var(--wa-green);
  color: #fff;
  border-radius: var(--rc-r-pill);
  padding: 20px 24px;
  text-align: center;
  box-shadow: 0 12px 24px -8px rgba(37,211,102,.35),
              0 2px 6px rgba(20,20,18,.08);
  transition: transform 140ms var(--rc-ease-standard),
              box-shadow 140ms var(--rc-ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.cta:active {
  transform: scale(0.98);
  box-shadow: 0 6px 12px -4px rgba(37,211,102,.30);
}
.cta-content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.cta-note {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  opacity: 0.85;
  font-weight: 400;
}

.rating {
  text-align: center;
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.rating .stars {
  display: inline-flex;
  gap: 1px;
  align-items: center;
}
.rating .stars svg { display: block; }
.rating .label {
  font-size: 11.5px;
  color: var(--rc-fg-3);
  margin-left: 6px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes rc-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}
@keyframes rc-caret {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes rc-chip-in {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots span,
  .bot-message .caret,
  .chip { animation: none !important; }
}
