/* 기본 폰트 및 리셋 */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px 12px 60px;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* 상단 헤더 */
.header-card {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 50%, #06b6d4 100%);
  color: white;
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.header-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.badge-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.header-card h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.header-card p {
  font-size: 1rem;
  opacity: 0.95;
  font-weight: 400;
  line-height: 1.5;
}

.header-nav-btn {
  position: absolute;
  top: 24px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-nav-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* 진행 단계 인디케이터 (Stepper) */
.stepper-nav {
  display: flex;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 10px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s;
}

.step-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

.step-item.completed {
  color: var(--success);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.step-item.active .step-num {
  background: var(--primary);
  color: white;
}

.step-item.completed .step-num {
  background: var(--success);
  color: white;
}

/* 섹션 공통 */
.step-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.step-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* 1단계: 학생 정보 입력 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.form-control {
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s;
  outline: none;
  background: #fff;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* 2단계: 영상 학습관 */
.progress-bar-wrap {
  background: #e2e8f0;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin: 12px 0 20px;
}

.progress-bar-fill {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
}

.video-player-container {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  padding-top: 56.25%; /* 16:9 비율 */
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.video-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.current-video-info {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.current-video-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1e293b;
}

.video-actions {
  display: flex;
  gap: 8px;
}

.btn-watch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e2e8f0;
  color: #475569;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-watch-toggle.watched {
  background: #10b981;
  color: white;
}

.btn-external-yt {
  background: #ef4444;
  color: white;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.btn-external-yt:hover {
  opacity: 0.9;
}

/* 영상 리스트 그리드 */
.video-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.video-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.video-item-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.video-item-card.active {
  border-color: var(--primary);
  background: #f5f7ff;
}

.video-item-card.watched .video-check-icon {
  background: #10b981;
  color: white;
}

.video-index-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: #6366f1;
  background: #eef2ff;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 52px;
  text-align: center;
}

.video-item-content {
  flex: 1;
}

.video-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 2px;
}

.video-item-meta {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  gap: 12px;
}

.video-check-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: transparent;
  flex-shrink: 0;
}

/* 3단계: 자가 점검 (Self-Assessment) */
.survey-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.survey-item:focus-within {
  border-color: var(--primary);
}

.survey-q-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  color: #1e293b;
}

.survey-q-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 14px;
}

.likert-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  padding: 10px;
  border-radius: 12px;
}

.likert-option {
  flex: 1;
  text-align: center;
}

.likert-option input[type="radio"] {
  display: none;
}

.likert-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  background: white;
  border: 1px solid #cbd5e1;
  transition: all 0.2s;
  min-height: 52px;
}

.likert-btn .score-num {
  font-weight: 800;
  font-size: 1.05rem;
  color: #334155;
}

.likert-btn .score-text {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 2px;
}

.likert-option input[type="radio"]:checked + .likert-btn {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.likert-option input[type="radio"]:checked + .likert-btn .score-num,
.likert-option input[type="radio"]:checked + .likert-btn .score-text {
  color: white;
  font-weight: 700;
}

/* 실시간 점수 피드백 박스 */
.score-summary-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.score-badge {
  font-size: 1.8rem;
  font-weight: 800;
  color: #15803d;
}

/* 4단계: 실천 다짐 (Pledge) */
.pledge-textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
  background: #fff;
}

.pledge-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.pledge-examples {
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: #475569;
  margin-bottom: 20px;
}

.pledge-examples ul {
  padding-left: 20px;
  margin-top: 6px;
}

.pledge-examples li {
  margin-bottom: 4px;
}

/* 서약서 미리보기 카드 */
.pledge-preview-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.pledge-cert-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pledge-cert-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fde047;
  letter-spacing: 0.5px;
}

.pledge-cert-body {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.pledge-cert-user {
  font-weight: 700;
  color: #93c5fd;
}

.pledge-cert-text {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 12px 0;
  font-style: italic;
}

.pledge-cert-footer {
  text-align: right;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* 공통 버튼 */
.btn-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-success {
  background: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: #059669;
}

/* 완료 화면 */
.success-card {
  text-align: center;
  padding: 40px 24px;
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.success-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.success-desc {
  color: #64748b;
  margin-bottom: 24px;
  font-size: 1rem;
}

/* 교사용 뷰 스타일 */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-top: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 12px 14px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1.5px solid #cbd5e1;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  white-space: nowrap;
}

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

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-title {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}
