/* ==========================================================
   Konnect Score — Chat / Sophie interface styles
   Designed mobile-first. Chat takes full viewport height.
   ========================================================== */

/* ============== BODY (chat-specific) ============== */
.chat-body {
  background: #fafaf7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============== HEADER ============== */
.chat-header {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.chat-header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.chat-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1872B4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}
.chat-brand-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.chat-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 11px;
  color: #b0b8c0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.chat-progress-bar {
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}
.chat-progress-fill {
  height: 100%;
  background: #1872B4;
  width: 0%;
  transition: width 0.4s ease;
}

/* ============== VIEW SWITCHING ============== */
.view {
  display: none;
  flex: 1;
  width: 100%;
}
.view.active { display: flex; flex-direction: column; }

/* ============== CHAT VIEW ============== */
.chat-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.messages {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============== MESSAGE BUBBLES ============== */
.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: fade-in 0.4s ease-out;
}
.message.from-sophie { justify-content: flex-start; }
.message.from-user { justify-content: flex-end; }

.message-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1872B4;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  margin-top: 2px;
}

.message-bubble {
  background: #ffffff;
  border: 1px solid #ece8e0;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.55;
  color: #1a1a1a;
  max-width: min(560px, 88%);
  border-bottom-left-radius: 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message.from-user .message-bubble {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 6px;
}

/* Sophie typing indicator */
.message-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}
.message-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c4c4c4;
  animation: typing-dot 1.2s infinite;
}
.message-typing span:nth-child(2) { animation-delay: 0.15s; }
.message-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============== CHAT FOOTER (CHOICES) ============== */
.chat-footer {
  background: #fafaf7;
  border-top: 1px solid #ece8e0;
  padding: 16px 20px 20px;
  position: sticky;
  bottom: 0;
}
.choices {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice-btn {
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.choice-btn:hover {
  border-color: #1872B4;
  background: #f4f8fc;
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.selected {
  border-color: #1872B4;
  background: #1872B4;
  color: #fff;
}
.choice-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Q12 multi-select submit row */
.choices-multi-submit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.choices-multi-submit .btn {
  flex: 1;
}
.choices-multi-hint {
  font-size: 12px;
  color: #6b747d;
  text-align: center;
  margin-top: 4px;
}

.chat-disclaimer {
  max-width: 720px;
  margin: 12px auto 0;
  font-size: 11px;
  color: #9ba4ad;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ============== SCORE REVEAL VIEW ============== */
#view-score {
  background: linear-gradient(135deg, #fde7d3 0%, #f9d4c0 50%, #f5c8b8 100%);
  align-items: center;
  justify-content: flex-start;
  padding: 56px 20px 80px;
}
.score-wrap {
  max-width: 580px;
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: 24px;
  padding: 48px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  animation: score-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes score-pop {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.score-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #c47a4a;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.score-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(96px, 18vw, 144px);
  font-weight: 500;
  line-height: 1;
  color: #1a1a1a;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  animation: score-count 1s ease-out;
}
@keyframes score-count {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.score-grade {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1872B4;
  margin-bottom: 28px;
  text-transform: uppercase;
}
.score-grade.grade-A { color: #2D8A5F; }
.score-grade.grade-B { color: #1872B4; }
.score-grade.grade-C { color: #D89E39; }
.score-grade.grade-D { color: #C47A4A; }
.score-grade.grade-F { color: #B23A3A; }

.score-band-copy {
  font-size: 16px;
  line-height: 1.65;
  color: #4a4a4a;
  margin-bottom: 32px;
  text-align: left;
}

.score-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
  padding: 24px;
  background: #fafaf7;
  border-radius: 16px;
}
.score-category {
  text-align: center;
}
.score-category-label {
  font-size: 11px;
  color: #6b747d;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  line-height: 1.3;
}
.score-category-value {
  font-size: 26px;
  font-weight: 600;
  color: #1a1a1a;
  font-family: 'Playfair Display', Georgia, serif;
}
.score-category-value.high { color: #2D8A5F; }
.score-category-value.mid { color: #D89E39; }
.score-category-value.low { color: #B23A3A; }

.score-headline {
  background: #fff8f1;
  border-left: 4px solid #c47a4a;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 32px;
  text-align: left;
}
.score-headline-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #c47a4a;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.score-headline p {
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  margin: 0;
}

.score-cta-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.score-cta-row .btn-primary { width: 100%; max-width: 320px; }
.score-microcopy {
  margin-top: 14px;
  font-size: 12px;
  color: #6b747d;
}

/* ============== EMAIL GATE VIEW ============== */
#view-email {
  align-items: center;
  justify-content: center;
  padding: 56px 20px 80px;
}
.email-wrap {
  max-width: 480px;
  width: 100%;
}
.email-back {
  margin-bottom: 24px;
  padding: 0;
  display: inline-block;
}
.email-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  margin-bottom: 12px;
}
.email-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: #4a4a4a;
  margin-bottom: 28px;
}
.email-form .field {
  margin-bottom: 16px;
}
.email-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #6b747d;
  margin-bottom: 6px;
}
.field-optional {
  font-weight: 400;
  color: #9ba4ad;
  font-size: 12px;
}
.email-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  transition: border-color 0.15s;
}
.email-form input:focus {
  outline: none;
  border-color: #1872B4;
  box-shadow: 0 0 0 3px rgba(24, 114, 180, 0.12);
}
.email-submit {
  width: 100%;
  margin-top: 8px;
  position: relative;
}
.email-submit .btn-loader {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
.email-submit.loading .btn-label { opacity: 0.8; }
.email-submit.loading .btn-loader { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.email-submit[disabled] { opacity: 0.7; cursor: not-allowed; }

.email-microcopy {
  margin-top: 14px;
  font-size: 12px;
  color: #6b747d;
  line-height: 1.5;
  text-align: center;
}

.email-error {
  background: #fff1ee;
  border-left: 3px solid #b23a3a;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: #b23a3a;
  margin-top: 12px;
}

/* ============== DONE VIEW ============== */
#view-done {
  align-items: center;
  justify-content: center;
  padding: 60px 20px 80px;
}
.done-wrap {
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.done-check {
  margin-bottom: 28px;
}
.done-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  margin-bottom: 12px;
}
.done-subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: #4a4a4a;
  margin-bottom: 32px;
}
.done-calendar {
  background: #fff8f1;
  border-radius: 16px;
  padding: 24px 20px;
  margin-bottom: 28px;
}
.done-calendar-label {
  font-size: 14px;
  color: #4a4a4a;
  margin-bottom: 12px;
}
.done-home {
  display: inline-block;
  margin-top: 16px;
  padding: 0;
}

/* ============== MOBILE TWEAKS ============== */
@media (max-width: 600px) {
  .chat-progress-bar { width: 80px; }
  .chat-brand-name { font-size: 13px; }
  .chat-scroll { padding: 16px 14px; }
  .chat-footer { padding: 12px 14px 16px; }
  .choice-btn { padding: 12px 14px; font-size: 14.5px; }
  .message-bubble { padding: 12px 14px; font-size: 15px; max-width: 86%; }
  .score-wrap { padding: 36px 24px; }
  .score-categories { padding: 18px; gap: 10px; }
}
