/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

/* ===== 헤더 ===== */
.dash-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
.dash-header-inner {
  max-width: 1440px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dash-header-left  { display: flex; align-items: center; gap: 14px; }
.dash-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.back-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: #334155; border: 1px solid #475569;
  color: #94a3b8; display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.back-btn:hover { background: #475569; color: #e2e8f0; }

.dash-logo { display: flex; align-items: center; gap: 10px; }
.dash-logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; flex-shrink: 0;
}
.dash-logo-title { font-size: 16px; font-weight: 800; color: #f1f5f9; }
.dash-logo-sub   { font-size: 11px; color: #64748b; margin-top: 1px; }

.last-updated-label { font-size: 11px; color: #475569; }
.refresh-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  background: #334155; border: 1px solid #475569;
  color: #94a3b8; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.refresh-btn:hover { background: #3b82f6; border-color: #3b82f6; color: white; }
.refresh-btn.loading { pointer-events: none; opacity: 0.6; }

/* ===== 비밀번호 게이트 ===== */
.pw-gate-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 68px);
  padding: 24px;
}
.pw-gate-box {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 20px; padding: 40px 36px;
  width: 100%; max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.pw-gate-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 26px; color: white;
}
.pw-gate-title { font-size: 20px; font-weight: 800; color: #f1f5f9; margin-bottom: 6px; }
.pw-gate-sub   { font-size: 13px; color: #64748b; }
.pw-input {
  width: 100%; padding: 12px 44px 12px 16px;
  background: #0f172a; border: 1.5px solid #334155; border-radius: 10px;
  color: #e2e8f0; font-size: 14px; font-family: inherit;
  transition: border-color 0.2s;
}
.pw-input:focus { outline: none; border-color: #3b82f6; }
.pw-eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #475569; font-size: 14px;
}
.pw-error { font-size: 12px; color: #f87171; margin-bottom: 0; }
.pw-error i { margin-right: 4px; }
.pw-submit-btn {
  width: 100%; padding: 12px; margin-top: 16px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white; font-size: 15px; font-weight: 700;
  border: none; cursor: pointer; font-family: inherit; transition: opacity 0.2s;
}
.pw-submit-btn:hover { opacity: 0.9; }

/* ===== 메인 레이아웃 ===== */
.dash-main {
  max-width: 1440px; margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ===== 필터 바 ===== */
.filter-bar {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  background: #1e293b; border: 1px solid #334155;
  border-radius: 12px; padding: 14px 18px; margin-bottom: 22px;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { font-size: 12px; font-weight: 700; color: #64748b; white-space: nowrap; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px; border-radius: 20px;
  background: #0f172a; border: 1px solid #334155;
  color: #94a3b8; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.18s; font-family: inherit;
}
.chip:hover { border-color: #3b82f6; color: #93c5fd; }
.chip.active { background: #3b82f6; border-color: #3b82f6; color: white; }

/* ===== KPI 카드 ===== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.kpi-card {
  border-radius: 14px; padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
  position: relative; overflow: hidden;
  border: 1px solid transparent;
}
.kpi-card::before {
  content: '';
  position: absolute; inset: 0; border-radius: 14px;
  opacity: 0.07;
}
.kpi-blue   { background: linear-gradient(135deg, #1e3a5f, #1e293b); border-color: #1d4ed8; }
.kpi-yellow { background: linear-gradient(135deg, #3d2f00, #1e293b); border-color: #d97706; }
.kpi-green  { background: linear-gradient(135deg, #052e16, #1e293b); border-color: #16a34a; }
.kpi-purple { background: linear-gradient(135deg, #2e1065, #1e293b); border-color: #7c3aed; }

.kpi-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.kpi-blue   .kpi-icon { background: rgba(59,130,246,0.2); color: #60a5fa; }
.kpi-yellow .kpi-icon { background: rgba(234,179,8,0.2);  color: #fbbf24; }
.kpi-green  .kpi-icon { background: rgba(34,197,94,0.2);  color: #4ade80; }
.kpi-purple .kpi-icon { background: rgba(139,92,246,0.2); color: #a78bfa; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-value {
  font-size: 32px; font-weight: 800; line-height: 1;
  color: #f1f5f9; margin-bottom: 4px;
}
.kpi-label { font-size: 12px; color: #64748b; font-weight: 600; }
.kpi-trend { font-size: 12px; color: #94a3b8; margin-top: 6px; }

/* ===== 차트 행 ===== */
.chart-row {
  display: grid; gap: 14px; margin-bottom: 14px;
}
.chart-row:has(.chart-card-md):has(.chart-card-md) {
  grid-template-columns: 1fr 1fr;
}
.chart-row:has(.chart-card-lg):has(.chart-card-sm) {
  grid-template-columns: 2fr 1fr;
}

/* ===== 차트 카드 ===== */
.chart-card {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 14px; padding: 20px;
  position: relative; overflow: hidden;
}
.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.chart-card-title {
  font-size: 14px; font-weight: 700; color: #e2e8f0;
  display: flex; align-items: center; gap: 7px;
}
.chart-card-title i { color: #3b82f6; font-size: 13px; }
.chart-card-sub { font-size: 11px; color: #475569; white-space: nowrap; }

/* ===== 테이블 ===== */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.data-table thead tr {
  background: #0f172a;
}
.data-table th {
  padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap; border-bottom: 1px solid #334155;
}
.data-table tbody tr {
  border-bottom: 1px solid #1e293b;
  cursor: pointer; transition: background 0.15s;
}
.data-table tbody tr:hover { background: #0f172a; }
.data-table td {
  padding: 11px 12px; color: #cbd5e1; vertical-align: middle;
}
.table-empty {
  text-align: center; color: #475569; padding: 40px 0 !important;
  font-size: 14px;
}

/* 평점 바 (테이블) */
.rating-bar-wrap { display: flex; align-items: center; gap: 6px; }
.rating-bar-bg {
  flex: 1; height: 6px; background: #334155; border-radius: 4px; overflow: hidden;
}
.rating-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.6s ease;
}
.rating-val { font-size: 11px; color: #94a3b8; white-space: nowrap; }

/* 학년 뱃지 */
.grade-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 6px; font-size: 11px; font-weight: 700;
}
.gb-1 { background: #1e3a5f; color: #60a5fa; }
.gb-2 { background: #2e1065; color: #a78bfa; }
.gb-3 { background: #3d0012; color: #fb7185; }
.gb-s { background: #042f2e; color: #2dd4bf; }

/* 평균 뱃지 */
.avg-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.avg-high { background: rgba(34,197,94,0.15); color: #4ade80; }
.avg-mid  { background: rgba(234,179,8,0.15);  color: #fbbf24; }
.avg-low  { background: rgba(248,113,113,0.15);color: #f87171; }

/* 제출수 뱃지 */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(59,130,246,0.15); color: #60a5fa;
  font-size: 13px; font-weight: 700;
}

/* 참관록 보기 버튼 */
.obs-view-btn {
  padding: 4px 10px; border-radius: 6px;
  background: #334155; border: 1px solid #475569;
  color: #94a3b8; font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s; font-family: inherit;
}
.obs-view-btn:hover { background: #3b82f6; border-color: #3b82f6; color: white; }

/* ===== 참관록 피드 ===== */
.feed-card {
  background: #0f172a; border: 1px solid #1e293b;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  transition: border-color 0.2s;
}
.feed-card:hover { border-color: #334155; }
.feed-header {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px;
}
.feed-name    { font-size: 14px; font-weight: 700; color: #e2e8f0; }
.feed-child   { font-size: 11px; color: #475569; margin-left: 6px; }
.feed-score   { font-size: 13px; font-weight: 700; color: #fbbf24; white-space: nowrap; }
.feed-lesson  { font-size: 12px; color: #475569; margin-bottom: 6px; }
.feed-rows    { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.feed-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
}
.feed-row-q   { color: #64748b; }
.feed-row-s   { color: #fbbf24; letter-spacing: 1px; }
.feed-comment {
  font-size: 13px; color: #94a3b8; background: #1e293b;
  border-radius: 8px; padding: 10px 12px; line-height: 1.6;
}
.feed-time { font-size: 11px; color: #334155; text-align: right; margin-top: 6px; }

/* 빈 피드 */
.feed-empty {
  text-align: center; padding: 40px; color: #334155;
  font-size: 14px;
}
.feed-empty i { font-size: 36px; display: block; margin-bottom: 10px; }

/* ===== 모달 ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.hidden { display: none !important; }
.modal-box {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 16px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden; margin: auto;
}
.modal-header-grad {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  color: white;
}
.modal-close-btn {
  background: rgba(255,255,255,0.15); border: none;
  width: 32px; height: 32px; border-radius: 8px;
  color: white; font-size: 14px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.3); }
.btn-sec {
  padding: 10px 24px; border-radius: 8px;
  background: #334155; border: 1px solid #475569;
  color: #94a3b8; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.btn-sec:hover { background: #475569; color: #e2e8f0; }

/* ===== 모달 내 참관록 카드 ===== */
.modal-obs-card {
  background: #0f172a; border: 1px solid #334155;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}
.modal-obs-avg { 
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(251,191,36,0.15); color: #fbbf24;
  border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 700;
}

/* ===== 스크롤바 (다크) ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ===== 애니메이션 ===== */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.kpi-value { animation: countUp 0.5s ease; }

/* ===== 세분 필터 드롭다운 ===== */
.filter-group-lesson {
  flex: 1; min-width: 200px;
}
.filter-select {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  padding: 6px 32px 6px 12px;
  cursor: pointer;
  min-width: 220px;
  max-width: 360px;
  height: 34px;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.filter-select:focus { outline: none; border-color: #3b82f6; }
.filter-select option  { background: #1e293b; color: #e2e8f0; }
.filter-select optgroup { background: #0f172a; color: #64748b; font-style: normal; font-weight: 700; }

/* ===== 다운로드 버튼 ===== */
.filter-group-download {
  flex-shrink: 0;
  margin-left: auto;
}
.download-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  color: white; font-size: 13px; font-weight: 700;
  border: none; cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.download-btn:hover   { opacity: 0.9; transform: translateY(-1px); }
.download-btn:active  { transform: translateY(0); }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 모달 내 소형 다운로드 버튼 */
.download-btn-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: #334155; border: 1px solid #475569;
  color: #60a5fa; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: 'Noto Sans KR', sans-serif;
  transition: all 0.2s;
}
.download-btn-sm:hover { background: #1d4ed8; border-color: #1d4ed8; color: white; }

/* feed-comment 두 번째 색상 (참관 소감) */
.feed-comment + .feed-comment {
  border-left: 3px solid #0ea5e9;
}

/* ===== 반응형 ===== */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row:has(.chart-card-md):has(.chart-card-md) { grid-template-columns: 1fr; }
  .chart-row:has(.chart-card-lg):has(.chart-card-sm) { grid-template-columns: 1fr; }
  .filter-group-lesson { min-width: 160px; }
  .filter-select { min-width: 160px; }
}
@media (max-width: 768px) {
  .filter-bar { gap: 12px; }
  .filter-group-download { width: 100%; margin-left: 0; }
  .download-btn { width: 100%; justify-content: center; }
  .filter-group-lesson { width: 100%; }
  .filter-select { width: 100%; max-width: 100%; }
}
@media (max-width: 640px) {
  .kpi-grid  { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 24px; }
  .dash-header-inner { padding: 12px 14px; }
  .dash-main { padding: 14px 12px 32px; }
}
