/* ═══════════════════════════════════════════════════════════
   EDUPLEX ExamMakers – 프론트엔드 스타일
   워드프레스 테마 가로폭 100% 기준으로 자연스럽게 어울림
═══════════════════════════════════════════════════════════ */

:root {
  --eem-primary:  #0078d7;
  --eem-primary-d:#005fa3;
  --eem-success:  #107c10;
  --eem-danger:   #d13438;
  --eem-warning:  #c47900;
  --eem-bg:       #f6f8fb;
  --eem-border:   #dde1e6;
  --eem-radius:   8px;
  --eem-shadow:   0 2px 8px rgba(0,0,0,.08);
}

/* ── 공통 래퍼 ──────────────────────────────────────────── */
.eem-pub-wrap {
  width: 100%; max-width: 100%;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', -apple-system, sans-serif;
  font-size: 14px; color: #222; box-sizing: border-box;
}
.eem-pub-wrap *, .eem-pub-wrap *::before, .eem-pub-wrap *::after {
  box-sizing: border-box;
}

/* ── 헤더 ───────────────────────────────────────────────── */
.eem-pub-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; background: var(--eem-primary); color: #fff;
  border-radius: var(--eem-radius) var(--eem-radius) 0 0;
  margin-bottom: 0;
}
.eem-pub-header h2 { margin: 0; font-size: 18px; color: #fff; }
.eem-pub-user { font-size: 13px; }
.eem-pub-user strong { margin: 0 4px; }
.eem-logout-link { color: #fff; opacity: .8; text-decoration: underline; cursor: pointer; font-size: 12px; margin-left: 8px; }
.eem-logout-link:hover { opacity: 1; }

/* ── 탭 ─────────────────────────────────────────────────── */
.eem-pub-tabs {
  display: flex; gap: 0; background: #e8f0fe;
  border-bottom: 2px solid var(--eem-primary);
}
.eem-pub-tab {
  padding: 10px 22px; cursor: pointer; border: none;
  background: none; font-size: 13px; font-weight: 600; color: #555;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.eem-pub-tab:hover   { color: var(--eem-primary); }
.eem-pub-tab.active  { color: var(--eem-primary); border-bottom-color: var(--eem-primary); }

/* ── 패널 ───────────────────────────────────────────────── */
.eem-pub-panel { display: none; padding: 20px; background: #fff; border: 1px solid var(--eem-border); border-top: none; }
.eem-pub-panel.active { display: block; }

/* ── 폼 ─────────────────────────────────────────────────── */
.eem-gen-form { background: var(--eem-bg); padding: 18px 20px; border-radius: var(--eem-radius); }
.eem-gen-row {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  margin-bottom: 12px;
}
.eem-gen-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #444; min-width: 120px; }
.eem-select {
  padding: 8px 12px; border: 1px solid var(--eem-border);
  border-radius: var(--eem-radius); font-size: 13px;
  background: #fff; min-width: 130px;
}
.eem-input-sm {
  padding: 8px 10px; border: 1px solid var(--eem-border);
  border-radius: var(--eem-radius); width: 80px; font-size: 13px;
}
.eem-gen-options { margin-top: 0; }
.eem-gen-actions { margin-top: 8px; }

/* ── 버튼 ───────────────────────────────────────────────── */
.eem-pub-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 18px; border-radius: var(--eem-radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--eem-border); background: #fff; color: #333;
  text-decoration: none; transition: background .15s;
}
.eem-pub-btn:hover { background: #f0f0f0; }
.eem-pub-btn-primary { background: var(--eem-primary); color: #fff; border-color: var(--eem-primary); }
.eem-pub-btn-primary:hover { background: var(--eem-primary-d); }
.eem-pub-btn-success { background: var(--eem-success); color: #fff; border-color: var(--eem-success); }
.eem-pub-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 생성 오버레이 ──────────────────────────────────────── */
.eem-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
}
.eem-overlay-box {
  background: #fff; border-radius: 12px; padding: 40px 48px;
  text-align: center; min-width: 300px; box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.eem-spinner {
  width: 48px; height: 48px; border: 5px solid #e0e7ff;
  border-top-color: var(--eem-primary); border-radius: 50%;
  animation: eem-spin .7s linear infinite; margin: 0 auto 14px;
}
@keyframes eem-spin { to { transform: rotate(360deg); } }
.eem-progress-bar-wrap {
  height: 8px; background: #e0e7ff; border-radius: 4px; margin: 12px 0 6px;
}
.eem-progress-bar {
  height: 100%; background: var(--eem-primary); border-radius: 4px; transition: width .4s;
}
#eem-generating-msg { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: #333; }
#eem-progress-text  { font-size: 13px; color: #666; }

/* ── 시험지 결과 툴바 ───────────────────────────────────── */
#eem-exam-result { margin-top: 20px; }
.eem-result-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--eem-bg);
  border: 1px solid var(--eem-border); border-radius: var(--eem-radius) var(--eem-radius) 0 0;
  flex-wrap: wrap; gap: 10px;
}
.eem-result-toolbar h3 { margin: 0; font-size: 16px; }
.eem-result-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.eem-result-right label { font-size: 13px; display: flex; align-items: center; gap: 4px; }

/* ── 시험지 미리보기 (A4 비율 반응형) ──────────────────── */
.eem-exam-preview-wrap {
  border: 1px solid var(--eem-border); border-top: none;
  background: #e5e5e5; padding: 24px; min-height: 500px;
  overflow-y: auto; max-height: 80vh;
}
.eem-exam-preview-wrap .eem-print-wrap {
  background: #fff; margin: 0 auto; padding: 20mm;
  max-width: 210mm; box-shadow: 0 4px 20px rgba(0,0,0,.15);
  min-height: 297mm;
}

/* ── 인쇄 컬럼 레이아웃 (브라우저 미리보기용) ──────────── */
.eem-print-columns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 14mm;
}
@media (max-width: 600px) {
  .eem-print-columns { grid-template-columns: 1fr; }
}

/* ── 테이블 ─────────────────────────────────────────────── */
.eem-pub-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eem-pub-table th { background: var(--eem-bg); padding: 10px 12px; border-bottom: 2px solid var(--eem-border); text-align: left; font-weight: 600; }
.eem-pub-table td { padding: 9px 12px; border-bottom: 1px solid var(--eem-border); }
.eem-pub-table tr:hover td { background: #f0f6ff; }
.eem-empty { text-align: center; color: #999; padding: 28px; }

/* ── 페이지네이션 ──────────────────────────────────────── */
.eem-pagination { margin-top: 10px; display: flex; gap: 5px; }
.eem-page-btn {
  padding: 4px 10px; border: 1px solid var(--eem-border); border-radius: 4px;
  cursor: pointer; background: #fff; font-size: 12px;
}
.eem-page-btn.active { background: var(--eem-primary); color: #fff; border-color: var(--eem-primary); }

/* ── 로그인 폼 ──────────────────────────────────────────── */
.eem-login-wrap {
  display: flex; justify-content: center; padding: 40px 16px;
  background: var(--eem-bg); border-radius: var(--eem-radius);
}
.eem-login-box {
  background: #fff; border: 1px solid var(--eem-border);
  border-radius: var(--eem-radius); padding: 36px 40px;
  width: 100%; max-width: 400px; box-shadow: var(--eem-shadow);
  text-align: center;
}
.eem-login-logo { font-size: 28px; margin-bottom: 8px; }
.eem-login-box h2 { margin: 0 0 20px; font-size: 20px; color: #333; }
.eem-field { margin-bottom: 16px; text-align: left; }
.eem-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #444; }
.eem-field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--eem-border);
  border-radius: var(--eem-radius); font-size: 14px;
}
.eem-field input:focus { border-color: var(--eem-primary); outline: 2px solid #d0e7ff; }
.eem-error-msg { background: #fdf2f2; color: var(--eem-danger); padding: 8px 12px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.eem-info-msg  { background: #f0f6ff; color: #0050a0; padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
#eem-login-submit { width: 100%; margin-top: 4px; padding: 12px; font-size: 15px; }

/* ── 알림 토스트 ────────────────────────────────────────── */
.eem-pub-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999999;
  background: #222; color: #fff; padding: 12px 20px;
  border-radius: var(--eem-radius); font-size: 14px; max-width: 360px;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.eem-pub-toast.show { opacity: 1; }
.eem-pub-toast.error { background: var(--eem-danger); }
.eem-pub-toast.success { background: var(--eem-success); }
