/* ══════════════════════════════════════════
   MedSim – style.css
   AI Medical Consultation Platform
   ══════════════════════════════════════════ */

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

:root {
  --bg:           #F7F4EF;
  --surface:      #FFFFFF;
  --surface2:     #F0EDE6;
  --accent:       #2C5F4A;
  --accent2:      #4A8B6F;
  --accent-light: #E1F0E8;
  --accent-pale:  #f0f7f3;
  --text:         #1A1A1A;
  --text2:        #555;
  --text3:        #888;
  --border:       #E0DDD6;
  --danger:       #C0392B;
  --danger-bg:    #fdf0ef;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 12px rgba(0,0,0,0.07);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ── SCREENS ── */
.screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.screen.hidden { display: none; }
.screen.active  { display: flex; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════ */

.login-wrap {
  width: 100%;
  max-width: 440px;
  animation: fadeUp 0.4s ease;
}

.logo {
  text-align: center;
  margin-bottom: 28px;
}
.logo-icon {
  width: 62px;
  height: 62px;
  background: var(--accent);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 18px rgba(44,95,74,0.28);
}
.logo-icon svg {
  width: 32px;
  height: 32px;
  stroke: #fff;
}
.logo h1 {
  font-family: 'Lora', serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.logo p {
  font-size: 13px;
  color: var(--text3);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 5px;
}
.card .sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 26px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(74,139,111,0.12);
}

.btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}
.btn:hover  { background: var(--accent2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #bbb; cursor: not-allowed; transform: none; }

.err {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(192,57,43,0.2);
  margin-bottom: 16px;
}
.err.hidden { display: none; }

.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  margin-top: 16px;
}

/* ══════════════════════════════════════════
   CHAT SCREEN
   ══════════════════════════════════════════ */

#screen-chat {
  align-items: stretch;
  padding: 0;
}
.chat-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  animation: fadeUp 0.3s ease;
}

.chat-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2.5px solid var(--accent2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent);
}

.patient-info { flex: 1; }
.patient-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1px;
}
.patient-info p {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 3px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--accent-light);
  color: var(--accent);
}
.online-dot { color: var(--accent2); }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.msg-count {
  font-size: 11px;
  color: var(--text3);
}
.end-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.2s;
  white-space: nowrap;
}
.end-btn:hover {
  border-color: var(--accent2);
  color: var(--accent);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
  min-height: 0;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Welcome card */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  animation: popIn 0.35s ease;
  margin: auto 0;
}
.welcome-icon { font-size: 36px; margin-bottom: 12px; }
.welcome-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
}
.welcome-card p {
  font-size: 13px;
  color: var(--text3);
  max-width: 360px;
  margin: 0 auto 20px;
  line-height: 1.6;
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
}
.chip:hover {
  border-color: var(--accent2);
  color: var(--accent);
  background: var(--accent-pale);
}

/* Message bubbles */
.msg {
  max-width: 78%;
  padding: 13px 17px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  animation: slideIn 0.25s ease;
}
.msg.ai {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.msg.ai p { margin-bottom: 8px; }
.msg.ai p:last-child { margin-bottom: 0; }
.msg.ai ul, .msg.ai ol {
  padding-left: 18px;
  margin: 6px 0;
}
.msg.ai li { margin-bottom: 4px; }
.msg.ai strong { font-weight: 600; color: var(--accent); }
.msg.user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.system {
  background: var(--accent-pale);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  align-self: center;
  text-align: center;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--accent-light);
  max-width: 90%;
}

/* Msg sender label */
.msg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  padding-left: 2px;
}
.msg-label.ai-label  { align-self: flex-start; }
.msg-label.user-label { align-self: flex-end; color: var(--accent2); }

/* Typing indicator */
.msg.typing-indicator { padding: 14px 18px; }
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text3);
  display: block;
  animation: blink 1.3s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Input row */
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.chat-input-row textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 50px;
  max-height: 140px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}
.chat-input-row textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(74,139,111,0.12);
}
.chat-input-row textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.send-btn {
  width: 50px; height: 50px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}
.send-btn svg { width: 18px; height: 18px; stroke: #fff; }
.send-btn:hover  { background: var(--accent2); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { background: #bbb; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════
   SUMMARY SCREEN
   ══════════════════════════════════════════ */

#screen-feedback { align-items: flex-start; padding-top: 30px; }

.feedback-wrap {
  width: 100%;
  max-width: 560px;
  animation: fadeUp 0.4s ease;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.summary-icon-wrap {
  width: 64px; height: 64px;
  background: var(--accent-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.summary-icon { font-size: 30px; }

.feedback-title h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.feedback-title p {
  font-size: 13px;
  color: var(--text3);
}

/* Section labels */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}

/* Questions list */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}
.question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text2);
  animation: fadeUp 0.3s ease;
}
.q-num {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Key points */
.keypoints-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.keypoint-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  animation: fadeUp 0.3s ease;
}
.kp-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* Topics */
.topics-wrap {
  margin-top: 18px;
  margin-bottom: 20px;
}
.topics-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}
.topics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.topic-pill {
  padding: 5px 12px;
  border-radius: 16px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(44,95,74,0.15);
}

.feedback-actions { margin-top: 4px; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 520px) {
  .chat-wrap { padding: 10px; gap: 8px; }
  .chat-header { padding: 12px 14px; }
  .msg { max-width: 90%; font-size: 13px; }
  .welcome-card { padding: 20px 16px; }
  .suggestion-chips { gap: 6px; }
  .chip { font-size: 11px; padding: 6px 11px; }
}
