/* 발표 자료(deck.pptx)와 같은 색: 어두운 잉크 + 민트 */
:root {
  --ink: #141a26;
  --ink-2: #1b2230;
  --ink-card: #263043;
  --mint: #2bc48a;
  --mint-soft: #ddf5ec;
  --gray: #5b6b82;
  --gray-soft: #eef3f2;
  --bg: #ffffff;
  --text: #1b2230;
  --line: #e2e8e6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a26;
    --text: #eef3f2;
    --gray-soft: #263043;
    --line: #2c374c;
    --gray: #8fa3bf;
  }
}
:root[data-theme="dark"] {
  --bg: #141a26;
  --text: #eef3f2;
  --gray-soft: #263043;
  --line: #2c374c;
  --gray: #8fa3bf;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

/* ───── 채팅 화면 ───── */
.app {
  max-width: 760px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }

/* 말풍선 모양 로고 */
.logo {
  position: relative;
  width: 28px; height: 20px;
  background: var(--mint);
  border-radius: 7px;
}
.logo::after {
  content: "";
  position: absolute;
  left: 5px; bottom: -6px;
  border-left: 7px solid var(--mint);
  border-bottom: 7px solid transparent;
}

.ghost-btn {
  border: 1px solid var(--mint);
  background: transparent;
  color: var(--mint);
  font: inherit;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.ghost-btn:hover { background: var(--mint); color: #fff; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot  { align-self: flex-start; background: var(--gray-soft); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end;   background: var(--mint); color: #fff; border-bottom-right-radius: 4px; }
.msg.error { align-self: flex-start; background: #fff1e0; color: #8a4b00; }
.msg.typing { color: var(--gray); }
.msg.emergency { background: #fde8e8; color: #8a1c1c; }

/* 선택지 버튼 (봇 말풍선 아래) */
.options { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; max-width: 90%; }
.option-btn {
  border: 1px solid var(--mint);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.option-btn:hover { background: var(--mint-soft); color: var(--ink); }

/* 약 후보 카드 */
.drugs { align-self: flex-start; display: grid; gap: 8px; width: min(100%, 520px); }
.drug-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 4px solid var(--mint);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.drug-card span { font-size: 13px; color: var(--gray); }

/* 약 사진: 카드 썸네일 + 상세 사진 (식약처 사진은 가로로 긴 그림) */
.drug-card.has-image { flex-direction: row; align-items: center; gap: 12px; }
.drug-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.drug-thumb {
  flex: 0 0 auto;
  width: 88px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--gray-soft);
}
.drug-photo { align-self: flex-start; margin: 0; width: min(78%, 360px); }
.drug-photo-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--gray-soft);
}
.drug-photo figcaption { margin-top: 4px; font-size: 12px; color: var(--gray); }
.drug-card:hover:not(:disabled) { border-color: var(--mint); }
.drug-card:disabled { cursor: default; opacity: 0.6; }

.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.composer input:focus { border-color: var(--mint); }
.send-btn {
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--mint);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.send-btn:disabled { opacity: 0.5; cursor: default; }

/* ───── 모듈 자리 (02~08 이 버튼을 넣음) ───── */
.topbar-right { display: flex; align-items: center; gap: 8px; }
#topbar-tools { display: flex; align-items: center; gap: 8px; }
#composer-tools { display: flex; align-items: center; gap: 6px; }
#composer-tools:empty { display: none; }

/* 음성 인식 중간 결과: 입력창은 회색 글, 아래 작은 회색 줄 */
.composer input.interim { color: var(--gray); font-style: italic; }
.chat-interim { padding: 0 16px 10px; font-size: 13px; color: var(--gray); }
.chat-interim[hidden] { display: none; }

/* ───── 발표 자료 오버레이 ───── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 22, 0.92);
  backdrop-filter: blur(4px);
  animation: fade-in 0.15s ease-out;
}
.overlay[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.overlay-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#slide-img {
  display: block;
  min-width: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
}

#slide-img[hidden] { display: none; }

.slide-empty { color: #eef3f2; text-align: center; line-height: 1.8; }
.slide-empty code { background: var(--ink-card); padding: 2px 6px; border-radius: 4px; }

/* 화면 왼쪽/오른쪽 절반을 누르면 이전/다음 */
.nav-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nav-zone.prev { left: 0;  cursor: w-resize; }
.nav-zone.next { right: 0; cursor: e-resize; }

.overlay-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  color: #eef3f2;
}
.bar-spacer { flex: 1; }
.slide-count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }

.bar-btn {
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  color: #eef3f2;
  background: var(--ink-card);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.bar-btn:hover { background: var(--mint); color: var(--ink); }
.bar-btn:disabled { opacity: 0.35; cursor: default; background: var(--ink-card); color: #eef3f2; }
