/* 입시상담 가이드 — Shopify Sidekick 스타일 간결한 대화형 UI */
:root {
  --ag-bg: #f7f7f8;
  --ag-card: #ffffff;
  --ag-text: #1a1a1a;
  --ag-muted: #6b7280;
  --ag-border: #e5e7eb;
  --ag-primary: #2563eb;
  --ag-primary-hover: #1d4ed8;
  --ag-user-bg: #2563eb;
  --ag-user-text: #ffffff;
  --ag-radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--ag-bg);
  color: var(--ag-text);
  -webkit-font-smoothing: antialiased;
}

.admissions-page {
  max-width: 768px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ag-bg);
}

/* ── 첫 화면 ── */
.ag-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ag-welcome-inner {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.ag-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.ag-subtitle {
  font-size: 15px;
  color: var(--ag-muted);
  margin: 0 0 16px;
}

.ag-year-badge { margin-bottom: 24px; }

.ag-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ag-primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 12px;
}

.ag-welcome-form { margin-bottom: 20px; }

.ag-examples-label {
  font-size: 13px;
  color: var(--ag-muted);
  margin: 0 0 8px;
}

.ag-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.ag-example {
  font-size: 14px;
  color: var(--ag-text);
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 12px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}

.ag-example:hover { border-color: var(--ag-primary); }

.ag-privacy {
  font-size: 11px;
  color: var(--ag-muted);
  margin: 0;
}

/* ── 입력 폼 공통 ── */
.ag-input-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ag-input {
  flex: 1;
  font-size: 15px;
  padding: 14px 16px;
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  background: var(--ag-card);
  outline: none;
}

.ag-input:focus { border-color: var(--ag-primary); }

.ag-send {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  font-size: 20px;
  color: #fff;
  background: var(--ag-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.ag-send:hover { background: var(--ag-primary-hover); }
.ag-send:disabled { background: var(--ag-border); cursor: default; }

/* ── 대화 화면 ── */
.ag-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.ag-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ag-card);
  border-bottom: 1px solid var(--ag-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ag-back {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--ag-text);
}

.ag-header-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.ag-year-toggle {
  font-size: 12px;
  font-weight: 600;
  color: var(--ag-primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

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

.ag-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--ag-radius);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.ag-msg-user {
  align-self: flex-end;
  background: var(--ag-user-bg);
  color: var(--ag-user-text);
  border-bottom-right-radius: 4px;
}

.ag-msg-ai {
  align-self: flex-start;
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-bottom-left-radius: 4px;
  /* frontend-design 스킬: 근거가 긴 답변의 가독성 — 본문 행간 완화 */
  line-height: 1.75;
}

/* frontend-design 스킬: 키보드 포커스를 시각 구조의 일부로 */
.ag-example:focus-visible, .ag-send:focus-visible, .ag-back:focus-visible,
.ag-year-toggle:focus-visible, .ag-nav a:focus-visible, .ag-nav button:focus-visible {
  outline: 2px solid var(--ag-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ag-example, .ag-send { transition: none; }
}

.ag-msg-typing {
  color: var(--ag-muted);
  font-style: italic;
}

/* ── 답변 카드 ── */
.ag-card {
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 12px 16px;
  margin-top: 8px;
  font-size: 13px;
}

.ag-card-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.ag-card-source {
  font-size: 11px;
  color: var(--ag-muted);
  margin-top: 4px;
}

.ag-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ag-border);
  font-size: 12px;
}

.ag-sources-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.ag-source {
  display: block;
  color: var(--ag-primary);
  text-decoration: none;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-source-kind {
  color: var(--ag-muted);
  font-size: 11px;
  margin-right: 4px;
}

.ag-warning {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
}

.ag-chat-form {
  padding: 12px 16px;
  background: var(--ag-card);
  border-top: 1px solid var(--ag-border);
  position: sticky;
  bottom: 0;
}

/* ── PC ── */
@media (min-width: 769px) {
  .ag-welcome { padding: 48px; }
  .ag-title { font-size: 32px; }
}


/* 학생 정보 입력 */
.ag-profile { display:grid; grid-template-columns:1fr 1fr; gap:12px; width:100%; max-width:720px; margin:18px auto; text-align:left; }
.ag-profile label { display:flex; flex-direction:column; gap:6px; font-size:14px; font-weight:700; color:#27324a; }
.ag-profile input,.ag-profile select,.ag-profile textarea { width:100%; box-sizing:border-box; border:1px solid #d8deea; border-radius:10px; background:#fff; padding:11px 12px; font:inherit; color:#172033; }
.ag-profile textarea { resize:vertical; min-height:68px; }
.ag-profile-wide { grid-column:1 / -1; }
@media (max-width: 600px) { .ag-profile { grid-template-columns:1fr; gap:10px; margin:14px auto; } .ag-profile-wide { grid-column:auto; } .ag-profile input,.ag-profile select,.ag-profile textarea { font-size:16px; } }

/* 공용 대시보드에서 진입하는 회원 상담·검수 */
.ag-nav { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:16px; border-bottom:1px solid var(--ag-border); background:#fff; }
.ag-nav a,.ag-nav button,.ag-tools button { font:inherit; font-size:14px; color:var(--ag-primary); background:#fff; border:1px solid var(--ag-border); border-radius:8px; padding:9px 12px; cursor:pointer; text-decoration:none; }
.ag-tools { padding:20px; border-bottom:1px solid var(--ag-border); }
.ag-tools h2 {font-size:20px;} .ag-tools p {font-size:13px;line-height:1.7;color:var(--ag-muted);}
.ag-tools article {padding:16px 0;border-bottom:1px solid var(--ag-border);overflow-wrap:anywhere;}
.ag-tools pre {white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px;line-height:1.7;}
.ag-admin-filters {display:flex;flex-wrap:wrap;gap:12px;align-items:end;} .ag-admin-filters label {display:grid;gap:6px;font-size:13px;}
.ag-tools select,.ag-year-badge select {padding:9px;border:1px solid var(--ag-border);border-radius:8px;background:white;font:inherit;max-width:100%;}
.ag-input {min-width:0;} .ag-source {white-space:normal;overflow-wrap:anywhere;}
body[data-member="true"] .ag-welcome {padding:24px;} body[data-member="true"] .ag-chat {min-height:75dvh;}
@media(max-width:600px) {.ag-tools{padding:14px;} .ag-header{flex-wrap:wrap;} .ag-input{font-size:16px;} .ag-nav {gap:8px;}}
.ag-load { margin-top:24px; padding-top:16px; border-top:1px solid var(--ag-border); display:grid; gap:12px; }
.ag-load label { display:grid; gap:4px; font-size:13px; } .ag-load input[type=text],.ag-load select { font-size:16px; min-height:44px; padding:8px; }
.ag-load-row { display:grid; gap:12px; } .ag-load-error { color:#c5221f; }
#ag-load-result { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:13px; line-height:1.7; margin:0; }
.ag-reindex { display:grid; gap:8px; } .ag-reindex button { min-height:44px; }
.ag-reindex-bar { display:flex; align-items:center; gap:8px; } .ag-reindex-bar progress { flex:1; height:14px; min-width:0; } .ag-reindex-bar span { font-size:13px; min-width:3em; text-align:right; }
#ag-reindex-status { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:13px; line-height:1.7; margin:0; }
@media (min-width:601px) { .ag-reindex { grid-template-columns:repeat(3,auto); justify-content:start; align-items:center; } .ag-reindex-bar,#ag-reindex-status { grid-column:1 / -1; } }
@media (min-width:601px) { .ag-load-row { grid-template-columns:120px 1fr auto; align-items:end; } }
