/* ══════════════════════════════════════════════
   QWord2 Wizard — 단어장 생성기 전용 스타일
   qgen2-wizard.css 기반 + 단어장 색상 override
   ══════════════════════════════════════════════ */

/* ── QWord2 탭 네비게이션 ── */
.qw2-nav-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--q2-border);
}
.qw2-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 24px 10px;
  font-size: 18px;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.3;
}
.qw2-nav-tab:hover {
  color: var(--q2-text);
  text-decoration: none;
}
.qw2-nav-tab.is-active {
  color: #0ea5e9;
  border-bottom-color: #0ea5e9;
}
.qw2-nav-tab-sub {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qw2-nav-tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #94a3b8;
}
.qw2-nav-tab.is-active .qw2-nav-tab-badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0ea5e9;
}

/* ── 이력 테이블 (history.php) ── */
.qwh-wrap { margin-top: 4px; }
.qwh-table-wrap {
  background: #fff;
  border: 1px solid var(--q2-border);
  border-radius: 12px;
  overflow: hidden;
}
.qwh-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.qwh-table th {
  background: var(--q2-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--q2-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--q2-border);
}
.qwh-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--q2-text);
}
.qwh-table tr:last-child td { border-bottom: none; }
.qwh-table tr:hover td { background: var(--q2-bg); }
.qwh-title-cell { font-weight: 500; max-width: 320px; }
.qwh-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  display: block;
}
.qwh-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.08);
  color: #0ea5e9;
  border: 1px solid rgba(14, 165, 233, 0.2);
}
.qwh-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.qwh-btn-view {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
}
.qwh-btn-view:hover { opacity: 0.88; color: #fff; text-decoration: none; }
.qwh-btn-print { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.qwh-btn-print:hover { background: #dcfce7; color: #15803d; text-decoration: none; }
.qwh-btn-pdf { background: #fff5f5; color: #dc2626; border: 1px solid #fca5a5; }
.qwh-btn-pdf:hover { background: #fee2e2; color: #dc2626; text-decoration: none; }
.qwh-btn-hwp { background: #eff6ff; color: #2563eb; border: 1px solid #93c5fd; }
.qwh-btn-hwp:hover { background: #dbeafe; color: #2563eb; text-decoration: none; }
.qwh-btn-del { background: #fff0f0; color: #e53e3e; }
.qwh-btn-del:hover { background: #ffe0e0; }
.qwh-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.qwh-empty {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}
.qwh-empty i { font-size: 40px; margin-bottom: 12px; display: block; color: #cbd5e1; }
.qwh-empty-title { font-size: 16px; font-weight: 600; color: var(--q2-text-dim); margin-bottom: 6px; }
.qwh-empty-desc { font-size: 14px; }

/* ── QWord2 색상 override (--q2-primary 재정의) ── */
.qw2-brand-mark {
  background: #0ea5e9 !important;
}
.qw2-sel-badge {
  background: rgba(14, 165, 233, 0.08) !important;
  border-color: rgba(14, 165, 233, 0.25) !important;
  color: #0ea5e9 !important;
}
.qw2-opt-body {
  background: rgba(14, 165, 233, 0.03) !important;
}
.qw2-generate-btn {
  background: #0ea5e9 !important;
}
.qw2-generate-btn:hover:not(:disabled) {
  background: #0284c7 !important;
}

/* ── 우측 패널 헤더 (모드 탭 대체) ── */
.qw2-panel-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 8px 14px;
  background: rgba(14, 165, 233, 0.07);
  border-bottom: 3px solid #0ea5e9;
}
.qw2-panel-icon {
  font-size: 20px;
  color: #0ea5e9;
}
.qw2-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #0ea5e9;
}
.qw2-panel-sub {
  font-size: 12px;
  color: rgba(14, 165, 233, 0.7);
}

/* ── Radio 그룹 (정렬 방식) ── */
.qw2-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.qw2-radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: var(--q2-text);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--q2-border);
  background: var(--q2-white);
  transition: all 0.12s;
  user-select: none;
}
.qw2-radio-label:hover {
  border-color: #0ea5e9;
  color: #0ea5e9;
}
.qw2-radio-label input[type="radio"] {
  accent-color: #0ea5e9;
  cursor: pointer;
}
.qw2-radio-label:has(input:checked) {
  background: rgba(14, 165, 233, 0.08);
  border-color: #0ea5e9;
  color: #0ea5e9;
  font-weight: 600;
}

/* ── Checkbox 그룹 (레벨/품사 필터) ── */
.qw2-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.qw2-check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: var(--q2-text);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--q2-border);
  background: var(--q2-white);
  transition: all 0.12s;
  user-select: none;
}
.qw2-check-label:hover {
  border-color: #0ea5e9;
}
.qw2-check-label input[type="checkbox"] {
  accent-color: #0ea5e9;
  cursor: pointer;
}
.qw2-check-label:has(input:checked) {
  background: rgba(14, 165, 233, 0.08);
  border-color: #0ea5e9;
  color: #0ea5e9;
  font-weight: 600;
}

/* ── 표시 옵션 그리드 ── */
.qw2-show-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 4px;
}
.qw2-show-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--q2-text);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--q2-border);
  background: var(--q2-white);
  transition: all 0.12s;
  user-select: none;
}
.qw2-show-label:hover {
  border-color: #0ea5e9;
}
.qw2-show-label input[type="checkbox"] {
  accent-color: #0ea5e9;
  cursor: pointer;
}
.qw2-show-label:has(input:checked) {
  background: rgba(14, 165, 233, 0.08);
  border-color: #0ea5e9;
  color: #0ea5e9;
  font-weight: 600;
}

/* ── 레벨 타입 행 ── */
.qw2-level-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--q2-bg);
  border-radius: 6px;
}
.qw2-level-type-label {
  font-size: 13px;
  color: var(--q2-text-dim);
  flex-shrink: 0;
}
.qw2-level-type-btns {
  display: flex;
  gap: 4px;
  background: var(--q2-border);
  border-radius: 6px;
  padding: 3px;
}
.qw2-lt-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--q2-text-dim);
  cursor: pointer;
  transition: all 0.12s;
}
.qw2-lt-btn.active {
  background: var(--q2-white);
  color: #0ea5e9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ── 펭스코어 설명 버튼 ── */
.qw2-pengscore-help-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.qw2-pengscore-help-btn:hover {
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
}

/* ── 옵션 divider 보조 텍스트 ── */
.qw2-opt-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--q2-text-dim);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ── 단어 수 표시 ── */
#qw2SumWords.loading {
  color: var(--q2-text-dim);
  font-weight: 400;
}
#qw2SumWords.qw2-words-danger {
  color: var(--q2-danger) !important;
  font-weight: 700 !important;
}

/* ── 트리: 챕터만 체크박스 (지문은 클릭 없음) ── */
.q2-tree-row.passage.qw2-no-check {
  cursor: default;
  padding-left: 96px;
}
.q2-tree-row.passage.qw2-no-check:hover {
  background: var(--q2-bg);
}

/* 챕터 행 체크박스 색상 */
.qw2-wizard .q2-tree-check {
  accent-color: #0ea5e9;
}
.qw2-wizard .q2-book-check {
  accent-color: #0ea5e9;
}
.qw2-wizard .q2-book-tab.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
}
.qw2-wizard .q2-book-tab:hover {
  border-color: #7dd3fc;
}
.qw2-wizard .q2-search-input:focus {
  border-color: #0ea5e9;
}
.qw2-wizard .q2-book-card.has-selected {
  border-color: rgba(14, 165, 233, 0.45);
}
.qw2-wizard .q2-page-btn.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
}

/* ── 단어장 제목 입력 ── */
.qw2-title-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  font-size: 15px;
  border: 1px solid var(--q2-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--q2-text);
  margin-top: 6px;
  outline: none;
  transition: border-color 0.15s;
}
.qw2-title-input:focus {
  border-color: #0ea5e9;
}
.qw2-title-input::placeholder {
  color: var(--q2-text-dim);
}
.qw2-title-input.q2-input-danger {
  border-color: var(--q2-danger);
  background: #fef2f2;
}
.qw2-title-input.q2-input-danger:focus {
  border-color: var(--q2-danger);
}

/* ── 출력 미리보기 오버레이 (qgen 동일 구조) ── */
.qg-print-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  align-items: center; justify-content: center;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.qg-print-overlay.is-show { display: flex; }
.qg-print-container {
  width: 100%; height: 100%; max-width: 1600px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; position: relative;
  background: #f1f5f9; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 24px 80px rgba(15,23,42,.25);
}
.qg-print-header {
  height: 48px; min-height: 48px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: #fff; border-bottom: 1px solid #e2e8f0;
  border-radius: 16px 16px 0 0;
}
.qg-print-title { font-size: 14px; font-weight: 600; color: #1e293b; }
.qg-print-close {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #e2e8f0; background: #f8fafc; font-size: 16px; color: #64748b;
  cursor: pointer; border-radius: 8px; transition: all .15s;
}
.qg-print-close:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.qg-print-iframe { flex: 1; border: none; width: 100%; border-radius: 0 0 16px 16px; }
.qg-print-loading {
  position: absolute; inset: 48px 0 0 0; border-radius: 0 0 16px 16px;
  background: #f8fafc; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; z-index: 10;
  transition: opacity .3s ease;
}
.qg-print-loading.is-done { opacity: 0; pointer-events: none; }
.qg-print-loading-char {
  width: 96px; height: auto;
  animation: qgPrintBob .9s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 16px rgba(99,102,241,.18));
}
.qg-print-loading-text { font-size: 15px; font-weight: 600; color: #334155; letter-spacing: -.2px; }
.qg-print-loading-name { font-weight: 800; color: #0ea5e9; }
.qg-print-loading-dots { display: flex; gap: 6px; }
.qg-print-loading-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: #0ea5e9;
  animation: qgPrintDot .9s ease-in-out infinite;
}
.qg-print-loading-dots span:nth-child(2) { animation-delay: .15s; }
.qg-print-loading-dots span:nth-child(3) { animation-delay: .3s; }

/* ── 단어장 생성 확인 팝업 ── */
.qw2-confirm-wrap {
  padding: 24px 20px 20px;
  text-align: left;
}
.qw2-confirm-icon {
  font-size: 36px;
  color: #0ea5e9;
  margin-bottom: 8px;
  text-align: center;
}
.qw2-confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 18px;
  text-align: center;
}
.qw2-confirm-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.qw2-confirm-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.qw2-confirm-badge {
  background: #0ea5e9;
  color: #fff;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.qw2-confirm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.qw2-confirm-tag {
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 500;
}
.qw2-confirm-tag-more {
  background: #f1f5f9;
  color: #64748b;
}
.qw2-confirm-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qw2-confirm-opt-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #334155;
}
.qw2-confirm-opt-row span:first-child {
  color: #94a3b8;
  font-size: 13px;
}
.qw2-confirm-credit {
  border-color: #bae6fd;
  background: #f0f9ff;
}
.qw2-confirm-opt-cost span:last-child  { color: #ef4444; font-weight: 600; }
.qw2-confirm-opt-remain span:last-child { color: #0ea5e9; font-weight: 700; }
.qw2-confirm-btns {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.qw2-confirm-btns .q2-popup-btn {
  flex: 1;
}
