/* ─── Chat with PDF — style.css ─── */
:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-input: #252525;
  --text: #e8e8e8;
  --text-dim: #999;
  --accent: #e94560;
  --accent2: #0f3460;
  --green: #10b981;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --radius: 12px;
  --max-w: 1100px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}
[data-theme="light"] {
  --bg: #f8f9fa;
  --bg-card: #fff;
  --bg-input: #f0f0f0;
  --text: #1a1a1a;
  --text-dim: #666;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── NAV ─── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,15,15,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #222;
  padding: 0 1.5rem;
}
[data-theme="light"] .nav { background: rgba(248,249,250,.9); border-color: #ddd; }
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.nav-logo {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.1rem; color: var(--text);
}
.nav-logo img { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: .9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 1.2rem; padding: 4px;
}

/* ─── HERO ─── */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
  text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .75rem; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-dim); font-size: 1.15rem; max-width: 600px; margin: 0 auto 2rem; }
.badge-row { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 2rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bg-card); border: 1px solid #333;
  padding: .35rem .85rem; border-radius: 999px; font-size: .82rem; color: var(--text-dim);
}
[data-theme="light"] .badge { border-color: #ddd; }

/* ─── DROPZONE ─── */
.dropzone {
  max-width: 600px; margin: 0 auto;
  border: 2px dashed #444;
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(233,69,96,.05);
}
.dropzone-icon { font-size: 3rem; margin-bottom: .75rem; }
.dropzone-text { color: var(--text-dim); font-size: .95rem; }
.dropzone-text strong { color: var(--text); }
.dropzone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ─── APP (PDF + Chat 영역) ─── */
.app-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  display: none; /* JS가 PDF 로드 시 표시 */
}
.app-container.active { display: block; }

/* 상단 바 */
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid #222;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
[data-theme="light"] .app-bar { border-color: #ddd; }
.pdf-name {
  font-weight: 600; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px;
}
.model-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .8rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  background: var(--bg-input); color: var(--text-dim); cursor: pointer;
}
.model-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.model-badge .dot.green { background: var(--green); }
.model-badge .dot.blue { background: var(--blue); }
.model-badge .dot.yellow { background: var(--yellow); }
.model-badge .dot.loading { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100%{ opacity: 1; } 50%{ opacity: .3; } }

.app-actions { display: flex; gap: .5rem; }
.btn-sm {
  padding: .35rem .75rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: .8rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--text); }

/* 본문: PDF 미리보기 + 채팅 */
.app-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 500px;
}
@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; }
  .pdf-sidebar { display: none; }
}

/* PDF 사이드바 */
.pdf-sidebar {
  background: var(--bg-card);
  border: 1px solid #222;
  border-radius: var(--radius);
  padding: .75rem;
  overflow-y: auto;
  max-height: 600px;
}
[data-theme="light"] .pdf-sidebar { border-color: #ddd; }
.pdf-sidebar h3 { font-size: .85rem; color: var(--text-dim); margin-bottom: .5rem; }
.page-thumb {
  width: 100%; border-radius: 6px;
  margin-bottom: .5rem; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s;
}
.page-thumb:hover, .page-thumb.active { border-color: var(--accent); }
.page-label { font-size: .75rem; color: var(--text-dim); text-align: center; margin-bottom: .75rem; }

/* 채팅 패널 */
.chat-panel {
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid #222;
  border-radius: var(--radius);
  overflow: hidden;
}
[data-theme="light"] .chat-panel { border-color: #ddd; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex; flex-direction: column; gap: .75rem;
  min-height: 350px; max-height: 500px;
}

/* 예시 질문 */
.example-questions {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: .75rem 1rem;
  justify-content: center;
}
.example-btn {
  padding: .4rem .85rem;
  border-radius: 999px;
  border: 1px solid #333;
  background: transparent;
  color: var(--text-dim);
  font-size: .82rem;
  cursor: pointer;
  transition: all .2s;
}
.example-btn:hover { border-color: var(--accent); color: var(--text); background: rgba(233,69,96,.08); }

/* 메시지 버블 */
.msg { max-width: 85%; padding: .75rem 1rem; border-radius: 14px; font-size: .9rem; line-height: 1.55; word-break: break-word; }
.msg-user {
  align-self: flex-end;
  background: var(--accent2);
  color: #e0e7ff;
  border-bottom-right-radius: 4px;
}
.msg-ai {
  align-self: flex-start;
  background: var(--bg-input);
  border-bottom-left-radius: 4px;
}
.msg-ai .page-ref {
  display: inline-block;
  background: rgba(233,69,96,.15);
  color: var(--accent);
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  margin-right: .25rem;
}
.msg-system {
  align-self: center;
  background: transparent;
  color: var(--text-dim);
  font-size: .82rem;
  text-align: center;
}
.msg-ai .cursor { display: inline-block; width: 2px; height: 1em; background: var(--accent); animation: blink .6s steps(2) infinite; vertical-align: text-bottom; margin-left: 2px; }
@keyframes blink { 0%{ opacity: 1; } 100%{ opacity: 0; } }

/* 프로그레스 바 */
.progress-bar {
  height: 4px; background: var(--bg-input); border-radius: 2px; overflow: hidden;
  margin: .5rem 1rem;
}
.progress-bar-fill { height: 100%; background: var(--green); transition: width .3s; width: 0%; }
.progress-text { font-size: .78rem; color: var(--text-dim); padding: 0 1rem .5rem; }

/* 입력 바 */
.chat-input-bar {
  display: flex; gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid #222;
  background: var(--bg);
}
[data-theme="light"] .chat-input-bar { border-color: #ddd; }
.chat-input {
  flex: 1;
  padding: .6rem 1rem;
  border-radius: 999px;
  border: 1px solid #333;
  background: var(--bg-input);
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-dim); }
.btn-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s;
  flex-shrink: 0;
}
.btn-send:disabled { opacity: .4; cursor: not-allowed; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%; max-width: 440px;
}
.modal h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.modal label { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: .3rem; }
.modal input, .modal select {
  width: 100%; padding: .55rem .75rem;
  border-radius: 8px; border: 1px solid #333;
  background: var(--bg-input); color: var(--text);
  font-size: .9rem; margin-bottom: 1rem;
}
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }
.btn-primary {
  padding: .55rem 1.25rem;
  border-radius: 8px; border: none;
  background: var(--accent); color: #fff;
  font-weight: 600; cursor: pointer;
  font-size: .9rem;
}
.btn-ghost {
  padding: .55rem 1.25rem;
  border-radius: 8px; border: 1px solid #333;
  background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: .9rem;
}

/* ─── SECTIONS ─── */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}
.section-title {
  font-size: 1.6rem; font-weight: 700; text-align: center; margin-bottom: .5rem;
}
.section-sub {
  text-align: center; color: var(--text-dim); font-size: 1rem; max-width: 600px; margin: 0 auto 2.5rem;
}

/* How it works — 3 steps */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.step-card {
  background: var(--bg-card);
  border: 1px solid #222;
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
}
[data-theme="light"] .step-card { border-color: #ddd; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem;
}
.step-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.step-card p { color: var(--text-dim); font-size: .9rem; }

/* Mode cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-top: 2rem;
}
.mode-card {
  background: var(--bg-card); border: 1px solid #222;
  border-radius: var(--radius); padding: 1.25rem;
}
[data-theme="light"] .mode-card { border-color: #ddd; }
.mode-card h4 { font-size: .95rem; margin-bottom: .4rem; }
.mode-card p { color: var(--text-dim); font-size: .85rem; }

/* FAQ */
.faq-list { max-width: 700px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid #222;
  padding: 1.25rem 0;
}
[data-theme="light"] .faq-item { border-color: #ddd; }
.faq-q {
  font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .95rem;
}
.faq-q::after { content: '+'; font-size: 1.2rem; color: var(--text-dim); transition: transform .2s; }
.faq-item.open .faq-q::after { content: '−'; }
.faq-a {
  max-height: 0; overflow: hidden;
  color: var(--text-dim); font-size: .9rem;
  transition: max-height .3s ease, padding .3s;
  padding-top: 0;
}
.faq-item.open .faq-a { max-height: 500px; padding-top: .75rem; }

/* ─── FOOTER ─── */
.footer {
  border-top: 1px solid #222;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}
[data-theme="light"] .footer { border-color: #ddd; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--text); }
.footer-hub { margin-top: .75rem; }
.footer-hub a { color: var(--accent); font-weight: 600; }

/* ─── PRIVACY / ABOUT pages ─── */
.page-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.page-content h1 { font-size: 2rem; margin-bottom: 1.5rem; }
.page-content h2 { font-size: 1.3rem; margin-top: 2rem; margin-bottom: .75rem; }
.page-content p, .page-content li { color: var(--text-dim); font-size: .95rem; margin-bottom: .75rem; }
.page-content ul { padding-left: 1.5rem; }

/* ─── UTILS ─── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media (max-width: 600px) {
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }
  .section-title { font-size: 1.3rem; }
  .nav-links { gap: .75rem; }
}
