/* ══════════════════════════════════════════════════════════
   QuickChat — Conversational form guide
   AI Teacher Labs
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Backdrop ────────────────────────────────────────────── */

#qcBackdrop {
  position: fixed;
  inset: 0;
  background: linear-gradient(150deg, rgba(15,28,58,0.96) 0%, rgba(26,48,95,0.96) 50%, rgba(35,65,120,0.96) 100%);
  z-index: 10050;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* ── Panel ───────────────────────────────────────────────── */

#qcPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  width: min(620px, 94vw);
  height: min(680px, 88vh);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  z-index: 10051;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ── Header ──────────────────────────────────────────────── */

.qc-header {
  background: linear-gradient(135deg, #2B4C8C, #3567B5);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.qc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qc-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.qc-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.qc-header-sub {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 1px;
}

.qc-close-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.qc-close-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Progress ────────────────────────────────────────────── */

.qc-progress-track {
  height: 3px;
  background: rgba(47,93,159,0.12);
  flex-shrink: 0;
}

.qc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2B4C8C, #14b8a6);
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Messages ────────────────────────────────────────────── */

.qc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* ── Bot message ─────────────────────────────────────────── */

.qc-msg-bot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: qc-msg-in 0.2s ease;
}

.qc-bot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #EEF3FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.qc-bot-bubble {
  background: #F1F5FB;
  color: #0F172A;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 3px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 85%;
}

.qc-bot-bubble strong { color: #2B4C8C; }

/* ── User message ────────────────────────────────────────── */

.qc-msg-user {
  display: flex;
  justify-content: flex-end;
  animation: qc-msg-in 0.2s ease;
}

.qc-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}

.qc-user-bubble {
  background: #2F5D9F;
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px 14px 3px 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 85%;
}

/* ── Answer wrap ─────────────────────────────────────────── */

.qc-answer-wrap {
  margin-left: 36px;
  animation: qc-msg-in 0.2s ease;
  transition: opacity 0.2s;
}

/* ── Chips ───────────────────────────────────────────────── */

.qc-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.qc-chip {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid #E6EDF6;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
  text-align: left;
}

.qc-chip:hover:not(:disabled) {
  border-color: #2F5D9F;
  color: #2F5D9F;
}

.qc-chip.qc-chip-on,
.qc-chip.qc-chip-on:hover {
  background: #2F5D9F;
  border-color: #2F5D9F;
  color: #fff;
  font-weight: 700;
}

.qc-chip-done-row {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.qc-chip-done-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2B4C8C, #3567B5);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: filter 0.15s;
  box-shadow: 0 2px 8px rgba(43,76,140,0.25);
}
.qc-chip-done-btn:hover { filter: brightness(1.08); }

/* ── Seg buttons ─────────────────────────────────────────── */

.qc-seg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.qc-seg-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid #E6EDF6;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
}

.qc-seg-btn:hover:not(:disabled) {
  border-color: #2F5D9F;
  color: #2F5D9F;
  background: #EEF3FF;
}

.qc-seg-btn.qc-seg-on {
  background: #EEF3FF;
  border-color: #2F5D9F;
  color: #2F5D9F;
  font-weight: 700;
}

/* ── Text input ──────────────────────────────────────────── */

.qc-text-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.qc-text-input {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  flex: 1;
  border: 1.5px solid #E6EDF6;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 14px;
  color: #0f172a;
  background: #FAFBFE;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.qc-text-input:focus {
  border-color: #2F5D9F;
  box-shadow: 0 0 0 3px rgba(47,93,159,0.08);
  background: #fff;
}

.qc-text-input::placeholder { color: #b8c5d4; }

.qc-text-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2F5D9F;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter 0.15s;
}
.qc-text-send:hover { filter: brightness(1.1); }

/* ── Footer ──────────────────────────────────────────────── */

.qc-footer {
  padding: 10px 18px;
  border-top: 1px solid #E6EDF6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: #FAFBFE;
}

.qc-back-btn,
.qc-skip-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}

.qc-back-btn:hover,
.qc-skip-btn:hover { color: #2F5D9F; }

/* ── Finish row ──────────────────────────────────────────── */

.qc-finish-row {
  margin-top: 20px;
  animation: qc-msg-in 0.2s ease;
}

.qc-finish-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.qc-finish-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s;
  width: 100%;
  text-align: center;
}
.qc-finish-btn:hover { filter: brightness(1.06); }

.qc-finish-edit {
  background: #F5F7FB;
  color: #475569;
  border: 1.5px solid #E6EDF6 !important;
}

.qc-finish-review {
  background: #fff;
  color: #2F5D9F;
  border: 1.5px solid rgba(47,93,159,0.3) !important;
}

.qc-finish-go {
  background: linear-gradient(135deg, #2B4C8C, #3567B5);
  color: #fff;
  box-shadow: 0 2px 10px rgba(43,76,140,0.3);
}

/* ── Animations ──────────────────────────────────────────── */

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

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 680px) {
  #qcPanel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 92vh;
    transform: none;
    border-radius: 20px 20px 0 0;
  }
  .qc-header { padding: 12px 14px; }
  .qc-header-title { font-size: 13px; }
  .qc-messages { padding: 14px 14px; gap: 10px; }
  .qc-answer-wrap { margin-left: 0; }
  .qc-chip-row { gap: 6px; }
  .qc-chip { font-size: 13px; padding: 9px 12px; }
  .qc-seg-btn { font-size: 13px; padding: 10px 12px; min-height: 44px; }
  .qc-seg-row { gap: 6px; }
  .qc-finish-row { flex-direction: column; }
  .qc-finish-btn { width: 100%; }
  .qc-footer { padding: 8px 14px; }
  .qc-bot-bubble { font-size: 13.5px; }
  .qc-user-bubble { font-size: 13.5px; }
  .qc-text-input { font-size: 16px; } /* prevent iOS zoom */
}

/* ── Other chip text input ────────────────────────────────── */

.qc-other-wrap {
  margin-top: 8px;
  display: flex;
  gap: 0;
  animation: qc-msg-in 0.15s ease;
}

.qc-other-wrap .qc-text-input {
  border-radius: 10px;
  font-size: 13.5px;
}

/* ── Editable user answer ─────────────────────────────────── */

.qc-user-answer {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.qc-edit-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  background: #EEF3FF;
  border: 1px solid rgba(47,93,159,0.2);
  color: #2F5D9F;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  align-self: flex-end;
  margin-right: 4px;
}

.qc-edit-btn:hover {
  background: #2F5D9F;
  color: #fff;
  border-color: #2F5D9F;
}

/* ── Voice / mic button ──────────────────────────────────── */

.qc-text-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.qc-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F1F5F9;
  border: 1.5px solid #E6EDF6;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.qc-mic-btn:hover {
  background: #EEF3FF;
  border-color: #2F5D9F;
}

.qc-mic-btn.qc-mic-listening {
  background: #fee2e2;
  border-color: #ef4444;
  animation: qc-pulse-mic 1s infinite;
}

.qc-mic-btn.qc-mic-done {
  background: #f0fdfa;
  border-color: #5eead4;
  color: #0d9488;
  font-size: 13px;
  font-weight: 700;
}

@keyframes qc-pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── Editing label ──────────────────────────────────────── */

.qc-editing-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  margin-left: 36px;
  animation: qc-msg-in 0.2s ease;
}



.qc-save-toast {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #0d9488;
  background: #f0fdfa;
  border: 1px solid #5eead4;
  border-radius: 20px;
  padding: 6px 14px;
  margin-left: 36px;
  display: inline-block;
  animation: qc-msg-in 0.2s ease;
}

/* ── Chat save button ─────────────────────────────────────── */

.qc-save-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qc-save-btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
}

/* ── Ctrl+click hint ─────────────────────────────────────── */

.qc-chip-hint {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11.5px;
  color: #94a3b8;
  font-style: italic;
  margin-top: 6px;
  padding-left: 2px;
}

.qc-skipped-bubble {
  background: #94a3b8 !important;
  font-style: italic;
  opacity: 0.8;
}

/* Hint text below Ada's question */
.qc-bot-hint {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 6px;
  margin-left: 44px;
  font-style: italic;
  font-weight: 400;
  padding: 0 4px;
}
