/* =========================================================
   L'ORÉAL SMART ROUTINE & PRODUCT ADVISOR
   Design tokens: ink black, warm paper, champagne gold.
   Serif wordmark (Playfair Display) + clean sans body (Work Sans),
   echoing L'Oréal's real black/gold luxury identity.
   ========================================================= */

:root {
  --ink: #141414;
  --paper: #FBF9F5;
  --paper-dim: #F3EFE8;
  --gold: #C9A96E;
  --gold-deep: #A9823E;
  --stone: #6B655C;
  --line: #E4DECF;
  --user-bubble: #F4EBD8;
  --assistant-bubble: #FFFFFF;
  --error: #8C2F2F;

  --radius: 18px;
  --shadow: 0 2px 14px rgba(20, 20, 20, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper-dim);
  color: var(--ink);
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

/* ---------- Header ---------- */
.header {
  padding: 32px 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.wordmark {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.12em;
  color: var(--ink);
  position: relative;
  display: inline-block;
}

.wordmark::after {
  content: "";
  display: block;
  width: 46px;
  height: 2px;
  background: var(--gold);
  margin: 10px auto 0;
}

.tagline {
  margin: 12px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
}

/* ---------- Current question strip (LevelUp) ---------- */
.current-question {
  padding: 0 24px;
  font-size: 13px;
  color: var(--gold-deep);
  font-weight: 600;
  min-height: 0;
  overflow: hidden;
  transition: all 0.25s ease;
}

.current-question:not(:empty) {
  padding: 14px 24px 0;
}

.current-question .label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  color: var(--stone);
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
}

/* ---------- Chat window ---------- */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 8px;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 84%;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: fadeIn 0.25s ease;
}

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

.msg--assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}

.msg--user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
  color: var(--ink);
}

.msg--error {
  align-self: flex-start;
  background: #FBEAEA;
  border: 1px solid #E9C6C6;
  color: var(--error);
}

.msg-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.55;
}

/* Typing indicator */
.typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: var(--assistant-bubble);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

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

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Input bar ---------- */
.input-bar {
  border-top: 1px solid var(--line);
  padding: 14px 20px 10px;
  background: var(--paper);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  padding: 10px 0;
}

.chat-input::placeholder {
  color: var(--stone);
  opacity: 0.75;
}

.send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--ink);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.send-btn:hover { background: var(--gold-deep); color: var(--ink); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.send-btn:focus-visible,
.chat-input:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

.footer-note {
  margin: 10px 0 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--stone);
  opacity: 0.8;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .app { max-width: 100%; }
}
