/* hotfix16.7 TASK 2: 모달 프리미티브 공용 스타일.
 *
 *   원래 settings-v1.css 에만 정의되어 Settings.html 에서만 적용됨.
 *   StudentReassignModal / SessionReassignModal 은 admin/teacher 모든 페이지에서 launch 되므로
 *   shared 위치로 이동. 이 파일을 modal launching 페이지에 모두 로드.
 *
 *   포함:
 *     - .modal-overlay / .modal-content / .modal-{sm,md,lg}
 *     - .modal-header / .modal-close / .modal-body / .modal-footer
 *     - .warning-text / .warning-box (+ .expandable variant) / .error-message
 *     - .btn-primary / .btn-secondary / .btn-danger (large) / .btn-sm.btn-{edit,danger}
 *     - .reassign-target-info / .reassign-row + sub
 *     - .session-reassign-modal + 카드 / 학생 리스트 / 일괄 적용
 *     - 기타 모달 안에서 쓰는 form-row 등 보조
 */

/* ─────────── 공통 모달 셸 ─────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 24px;
  overflow-y: auto;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,0.18);
  overflow: hidden;
}
.modal-content.modal-sm { max-width: 480px; }
.modal-content.modal-md { max-width: 640px; }
.modal-content.modal-lg { max-width: 720px; width: 90vw; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border, #E5E7EB);
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-header.danger { background: #FEF2F2; border-bottom-color: #FCA5A5; }
.modal-header.danger h3 { color: #991B1B; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--fg-muted, #9CA3AF);
  padding: 0;
  line-height: 1;
}
.modal-body {
  padding: 20px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
}

/* ─────────── 모달 안 form / 안내 ─────────── */
.modal-body .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.modal-body .form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary, #374151);
}
.modal-body .form-row label .required { color: #EF4444; margin-left: 2px; }
.modal-body .form-row input,
.modal-body .form-row select,
.modal-body .form-row textarea {
  padding: 8px 12px;
  border: 1px solid var(--border, #D1D5DB);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--fg-primary, #1F2937);
  background: #fff;
}
.modal-body .form-row input:focus,
.modal-body .form-row select:focus,
.modal-body .form-row textarea:focus {
  outline: none;
  border-color: var(--accent, #0D9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}
.modal-body .help-text { font-size: 11px; color: var(--fg-muted, #9CA3AF); margin-top: 2px; }

.warning-text {
  font-size: 14px;
  color: var(--fg-secondary, #374151);
  line-height: 1.6;
  margin: 0 0 16px;
}
.warning-box {
  background: #FEF3C7;
  border-left: 3px solid #F59E0B;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  color: #78350F;
  margin-bottom: 16px;
}
.error-message {
  background: #FEE2E2;
  border-left: 3px solid #DC2626;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: #991B1B;
  margin-top: 12px;
}

/* ─────────── 큰 버튼 (모달 footer 전용) ─────────── */
.modal-footer .btn-primary,
.modal-overlay .btn-primary {
  background: var(--accent, #0D9488);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.modal-footer .btn-primary:hover:not(:disabled),
.modal-overlay .btn-primary:hover:not(:disabled) { background: #0F766E; }
.modal-footer .btn-primary:disabled,
.modal-overlay .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-footer .btn-secondary,
.modal-overlay .btn-secondary {
  background: #fff;
  color: var(--fg-secondary, #374151);
  border: 1px solid var(--border, #D1D5DB);
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.modal-footer .btn-secondary:hover,
.modal-overlay .btn-secondary:hover { background: var(--color-bg-subtle, #F9FAFB); }

.modal-footer .btn-danger,
.modal-overlay .btn-danger {
  background: #DC2626;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.modal-footer .btn-danger:hover:not(:disabled),
.modal-overlay .btn-danger:hover:not(:disabled) { background: #B91C1C; }
.modal-footer .btn-danger:disabled,
.modal-overlay .btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─────────── 작은 버튼 (.btn-sm — outline 톤다운) ─────────── */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 56px;
  line-height: 1;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  vertical-align: middle;
  white-space: nowrap;
}
.btn-sm.btn-edit,
.btn-sm:not(.btn-danger) {
  color: #1D4ED8;
  background: #fff;
  border: 1px solid #BFDBFE;
}
.btn-sm.btn-edit:hover,
.btn-sm:not(.btn-danger):hover {
  background: #EFF6FF;
  border-color: #93C5FD;
}
.btn-sm.btn-danger {
  color: #DC2626;
  background: #fff;
  border: 1px solid #FCA5A5;
}
.btn-sm.btn-danger:hover {
  background: #FEF2F2;
  border-color: #F87171;
}
.btn-sm.btn-danger:active {
  background: #FEE2E2;
}

.btn-sm-tall {
  height: 32px !important;
  padding: 0 14px !important;
  font-size: 12px;
}

/* ─────────── StudentReassignModal — 학생 1명 → 다른 강의 ─────────── */
.reassign-target-info {
  background: var(--color-bg-subtle, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.reassign-row { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.reassign-row .rg-label {
  min-width: 84px;
  color: var(--fg-muted, #6B7280);
  font-weight: 500;
  font-size: 12px;
}
.reassign-row .rg-value { flex: 1; color: var(--fg-primary, #1F2937); }
.reassign-row .rg-tag-warning {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.reassign-row .rg-dim { color: var(--fg-muted, #9CA3AF); font-size: 11.5px; }
.reassign-row .rg-retired-tag {
  display: inline-block;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ─────────── SessionReassignModal — 강의 단위 ─────────── */
.session-reassign-modal { max-width: 720px; }

.reassign-summary {
  padding: 12px 16px;
  background: var(--color-bg-subtle, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.bulk-assign-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  margin-bottom: 16px;
}
.bulk-assign-row label {
  font-size: 13px;
  font-weight: 600;
  color: #1E40AF;
  margin: 0;
  flex-shrink: 0;
}
.bulk-assign-row select {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border, #D1D5DB);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.divider-with-label {
  position: relative;
  text-align: center;
  margin: 18px 0 12px;
  font-size: 11px;
  color: var(--fg-muted, #9CA3AF);
}
.divider-with-label::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border, #E5E7EB);
}
.divider-with-label span {
  position: relative;
  background: #fff;
  padding: 0 12px;
}

.session-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.session-card {
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 6px;
  background: #fff;
}
.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  gap: 12px;
}
.session-card-info { flex: 1; min-width: 0; }
.session-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.badge-class-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #F3F4F6;
  color: #374151;
}
.badge-class-type.type-정규반 { background: #CCFBF1; color: #0D9488; }
.badge-class-type.type-화상   { background: #DBEAFE; color: #1E40AF; }
.badge-class-type.type-특강   { background: #FED7AA; color: #C2410C; }
.badge-class-type.type-레벨테스트 { background: #E9D5FF; color: #7E22CE; }

.schedule-tag {
  display: inline-block;
  background: #F3F4F6;
  color: #374151;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.session-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--fg-muted, #6B7280);
}
.session-students-toggle {
  background: none;
  border: none;
  font-size: 11.5px;
  color: var(--accent, #0D9488);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-family: inherit;
  border-radius: 4px;
}
.session-students-toggle:hover {
  background: rgba(13, 148, 136, 0.08);
  text-decoration: none;
}
.session-students-toggle .expand-arrow {
  font-size: 9px;
  display: inline-block;
  transition: transform 0.15s ease;
}
.session-card-action { flex-shrink: 0; }
.session-card-action select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border, #D1D5DB);
  border-radius: 4px;
  font-size: 12px;
  min-width: 160px;
  font-family: inherit;
  background: #fff;
}
.session-students-list {
  border-top: 1px dashed var(--border, #E5E7EB);
  padding: 8px 14px 12px;
  background: var(--color-bg-subtle, #F9FAFB);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.session-student-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  padding: 4px 0;
  gap: 12px;
}
.session-student-row .student-name { font-weight: 600; color: var(--fg-primary, #111827); }
.session-student-row .student-meta { font-size: 11px; color: var(--fg-muted, #6B7280); }
/* hotfix17.1: 학생 row 좌(이름·학교·학생코드·전화) + 우(현재 강사·강의) — 재배정 안심 표기 */
.session-student-row .ssr-l { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.session-student-row .ssr-r {
  font-size: 11px;
  color: var(--fg-muted, #6B7280);
  white-space: nowrap;
  flex-shrink: 0;
}
.session-student-row .ssr-code { font-family: var(--font-mono); color: var(--fg-secondary, #4B5563); }
.session-students-empty {
  padding: 8px 14px 12px;
  font-size: 11px;
  color: var(--fg-muted, #9CA3AF);
  font-style: italic;
}

/* ─────────── 퇴직 모달 expand box ─────────── */
.retirement-pay { font-variant-numeric: tabular-nums; color: var(--fg-primary, #1F2937); }
.retirement-pay .dim { color: var(--fg-muted, #9CA3AF); }
.retirement-estimate-box {
  background: #FFFBEB;
  border-left: 3px solid #F59E0B;
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 14px;
  color: #78350F;
  margin-bottom: 16px;
}
.retirement-estimate-box strong { font-weight: 700; }
.estimate-note { font-size: 11px; color: #92400E; margin-top: 6px; line-height: 1.5; }

.warning-box.expandable {
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
}
.warning-box.expandable .warning-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  color: #78350F;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.warning-box.expandable .warning-header:hover { background: rgba(245, 158, 11, 0.08); }
.warning-box.expandable .expand-arrow { color: #92400E; font-size: 11px; }
.warning-box.expandable .warning-sub {
  padding: 0 14px 10px;
  font-size: 11.5px;
  color: #78350F;
  opacity: 0.85;
}
.warning-box.expandable .student-list-expanded {
  padding: 8px 14px 12px;
  background: rgba(245, 158, 11, 0.06);
  border-top: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.warning-box.expandable .student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--fg-primary, #1F2937);
}
.warning-box.expandable .student-row-meta { color: var(--fg-muted, #9CA3AF); font-weight: 400; }
.warning-box.expandable .hint-text {
  font-size: 11px;
  color: #92400E;
  line-height: 1.6;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px dashed rgba(245, 158, 11, 0.3);
}

.warning-box .btn-link {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 8px;
  color: #B45309;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
.warning-box .btn-link:hover { color: #92400E; }
.warning-box .warning-text-row { font-size: 13px; color: #78350F; line-height: 1.5; }
