/* ========================================================
   2026-2 대학한국어2 - Teacher Admin Styles
   Modern, Clean, Academic & Professional LMS Dashboard
   ======================================================== */

.admin-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  margin-bottom: 1.5rem;
}

.admin-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-badge {
  font-size: 0.72rem;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Nav Bar (Segmented Control Style) */
.admin-nav-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  background: #F1F5F9;
  border: 1px solid var(--border);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.admin-nav-item {
  background: transparent;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.admin-nav-item.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Admin Toolbar */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.admin-lesson-selector {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: white;
  min-width: 240px;
  color: var(--text-main);
}

/* Table Card */
.admin-table-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th, .admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}

.admin-table th {
  background: #F8FAFC;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.admin-table tbody tr:hover {
  background: #F8FAFC;
}

/* Sticky Table for Submissions Matrix (주차 확장 대비 좌측 고정 틀) */
#matrix-table-card {
  overflow-x: auto;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}

#matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#matrix-table th, 
#matrix-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

#matrix-table th:last-child,
#matrix-table td:last-child {
  border-right: none;
}

#matrix-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #F8FAFC;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Sticky Left 3 Columns: No., 학번, 학생 이름 */
#matrix-table th:nth-child(1),
#matrix-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #FFFFFF;
  width: 50px;
  min-width: 50px;
  text-align: center;
}

#matrix-table th:nth-child(1) {
  z-index: 5;
  background: #F8FAFC;
}

#matrix-table th:nth-child(2),
#matrix-table td:nth-child(2) {
  position: sticky;
  left: 50px;
  z-index: 4;
  background: #FFFFFF;
  width: 110px;
  min-width: 110px;
}

#matrix-table th:nth-child(2) {
  z-index: 5;
  background: #F8FAFC;
}

#matrix-table th:nth-child(3),
#matrix-table td:nth-child(3) {
  position: sticky;
  left: 160px;
  z-index: 4;
  background: #FFFFFF;
  width: 150px;
  min-width: 150px;
  border-right: 2px solid #CBD5E1 !important;
  box-shadow: 4px 0 6px -2px rgba(0, 0, 0, 0.06);
}

#matrix-table th:nth-child(3) {
  z-index: 5;
  background: #F8FAFC;
}

#matrix-table tbody tr:hover td {
  background: #F8FAFC;
}

#matrix-table tbody tr:hover td:nth-child(1),
#matrix-table tbody tr:hover td:nth-child(2),
#matrix-table tbody tr:hover td:nth-child(3) {
  background: #F1F5F9;
}

/* Backup Grid */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* Submissions Section */
.submissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
}

.submission-card {
  background: var(--surface);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.submission-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.student-name-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.submission-sentences-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sub-sent-row {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-xs);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.sub-sent-num {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.sub-sent-text {
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 500;
}

.sub-sent-body {
  flex: 1;
  min-width: 0;
}

.submissions-sync-note {
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  color: #92400E;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  cursor: pointer;
}

.submissions-sync-note:hover {
  background: #FEF3C7;
}

.sub-sent-row.has-correction {
  border-color: var(--primary-border);
  background: #FCFDFF;
}

/* ---- 문장 첨삭 입력 에디터 ---- */
.corr-done-badge {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  vertical-align: middle;
}

.corr-editor {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-strong);
}

.corr-editor-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.corr-textarea {
  font-size: 0.88rem;
  min-height: 44px;
  margin-bottom: 0.4rem;
}

.corr-comment {
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
}

.corr-preview {
  display: none;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  line-height: 1.55;
}

.corr-preview-line {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}

.corr-preview-line + .corr-preview-line {
  margin-top: 0.2rem;
}

.corr-tag {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  background: #E2E8F0;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}

.corr-tag-fix {
  color: #fff;
  background: var(--primary);
}

.corr-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* ========================================================
   교사 과제 확인 평가 (O, △, X) 스타일
   ======================================================== */
.grade-action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-subtle);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.grade-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 0.2rem;
}

.btn-grade {
  border: 1px solid var(--border);
  background: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-grade-o {
  color: #059669;
  border-color: #A7F3D0;
}

.btn-grade-o:hover,
.btn-grade-o.active {
  background: #059669;
  color: white;
  border-color: #059669;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.3);
}

.btn-grade-tri {
  color: #D97706;
  border-color: #FDE68A;
}

.btn-grade-tri:hover,
.btn-grade-tri.active {
  background: #D97706;
  color: white;
  border-color: #D97706;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.3);
}

.btn-grade-x {
  color: #DC2626;
  border-color: #FECACA;
}

.btn-grade-x:hover,
.btn-grade-x.active {
  background: #DC2626;
  color: white;
  border-color: #DC2626;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}

.btn-grade-clear {
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
}

/* 매트릭스 테이블 내 평가 뱃지 */
.matrix-cell-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.eval-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease;
  user-select: none;
}

.eval-badge:hover {
  transform: scale(1.05);
}

.eval-badge-o {
  background: #ECFDF5;
  color: #059669;
  border: 1.5px solid #10B981;
}

.eval-badge-tri {
  background: #FFFBEB;
  color: #D97706;
  border: 1.5px solid #F59E0B;
}

.eval-badge-x {
  background: #FEF2F2;
  color: #DC2626;
  border: 1.5px solid #EF4444;
}

.eval-badge-pending {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.eval-badge-none {
  background: #F8FAFC;
  color: #94A3B8;
  border: 1px dashed #CBD5E1;
}

/* Admin Mobile Responsive */
@media (max-width: 768px) {
  .admin-header .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .admin-header .d-flex {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .admin-nav-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 0.35rem;
  }

  .admin-nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================================
   다국어 (Multilingual) 관리자 입력 및 테이블 스타일
   ======================================================== */
.admin-lang-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 0.75rem;
}

@media (max-width: 540px) {
  .admin-lang-inputs-grid {
    grid-template-columns: 1fr;
  }
  .admin-lang-inputs-grid .admin-lang-input-item[style*="span 2"] {
    grid-column: span 1 !important;
  }
}

.admin-lang-input-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-lang-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.admin-multi-lang-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  max-width: 320px;
}

.admin-lang-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  line-height: 1.35;
}

.admin-lang-row-label {
  flex-shrink: 0;
  font-weight: 700;
  color: #64748B;
  font-size: 0.72rem;
  min-width: 55px;
}

.admin-lang-row-val {
  color: #0F172A;
  font-weight: 600;
  word-break: keep-all;
}

/* ========================================================
   과제 유인물 일괄 출력 (Handout Printable A4 1인 1장)
   ======================================================== */
.handout-page {
  background: #ffffff;
  width: 210mm;
  min-height: 290mm;
  padding: 10mm 12mm;
  margin: 0 auto 1.5rem auto;
  box-sizing: border-box;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  color: #1E293B;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
  position: relative;
  page-break-after: always;
  break-after: page;
  border-radius: 4px;
}

.handout-header-box {
  border: 2px solid #1E3A8A;
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  background: #F8FAFC;
}

.handout-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #CBD5E1;
  padding-bottom: 0.25rem;
  margin-bottom: 0.35rem;
}

.handout-school-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1E3A8A;
  letter-spacing: 0.02em;
}

.handout-week-badge {
  background: #1E3A8A;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.handout-lesson-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 0.4rem;
  text-align: center;
}

.handout-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.handout-meta-table th {
  background: #E2E8F0;
  color: #334155;
  font-weight: 700;
  text-align: center;
  padding: 0.25rem 0.4rem;
  border: 1px solid #CBD5E1;
  width: 12%;
}

.handout-meta-table td {
  background: #FFFFFF;
  color: #0F172A;
  padding: 0.25rem 0.4rem;
  border: 1px solid #CBD5E1;
  width: 21%;
}

.handout-section {
  margin-bottom: 0.75rem;
}

.handout-sec-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1E3A8A;
  border-left: 4px solid #1E3A8A;
  padding-left: 0.45rem;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.handout-words-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.handout-word-box {
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: #FAFAFA;
}

.handout-new-words {
  border-top: 3px solid #059669;
}

.handout-topic-words {
  border-top: 3px solid #2563EB;
}

.handout-word-box-title {
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.handout-new-words .handout-word-box-title { color: #047857; }
.handout-topic-words .handout-word-box-title { color: #1D4ED8; }

.handout-words-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.handout-word-item {
  font-size: 0.76rem;
  line-height: 1.3;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed #E2E8F0;
}
.handout-word-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hw-korean {
  font-weight: 700;
  color: #0F172A;
  margin-right: 0.25rem;
}

.hw-pos {
  font-size: 0.68rem;
  color: #475569;
  font-weight: 600;
  margin-right: 0.25rem;
}

.hw-pattern {
  font-size: 0.7rem;
  color: #4338CA;
  background: #EEF2FF;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  margin-right: 0.25rem;
}

.hw-meaning {
  font-size: 0.7rem;
  color: #64748B;
  display: block;
}

.handout-sentences-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.handout-sentences-table th {
  background: #F1F5F9;
  color: #334155;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
  border: 1px solid #CBD5E1;
  text-align: left;
}

.handout-sentences-table td {
  padding: 0.45rem 0.55rem;
  border: 1px solid #CBD5E1;
  vertical-align: top;
}

.hw-sent-target {
  background: #F8FAFC;
}

.hw-sent-pat {
  font-size: 0.7rem;
  color: #4338CA;
  margin-top: 0.15rem;
  font-weight: 600;
}

.hw-sent-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 0.2rem;
  line-height: 1.35;
}

.hw-corr-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  margin-top: 0.25rem;
}

.hw-corr-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #D97706;
  margin-right: 0.3rem;
}

.hw-corr-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #B45309;
}

.hw-corr-comment {
  font-size: 0.72rem;
  color: #92400E;
  margin-top: 0.1rem;
}

/* ========================================================
   인쇄 (Print) CSS 최적화
   ======================================================== */
#handout-print-area {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 6mm 8mm;
  }

  body > * {
    display: none !important;
  }

  #handout-print-area {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
  }

  #handout-print-area * {
    visibility: visible !important;
  }

  .handout-page {
    box-shadow: none !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 210mm !important;
    min-height: 275mm !important;
    max-height: 287mm !important;
    overflow: hidden !important;
    padding: 4mm 6mm !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    border-radius: 0 !important;
  }
}
