/* CSS Variables */
:root {
  /* Colors */
  --primary: #4A90E2;
  --primary-dark: #357ABD;
  --success: #2ECC71;
  --warning: #F39C12;
  --danger: #E74C3C;
  --secondary: #95A5A6;
  --light: #ECF0F1;
  --dark: #2C3E50;
  --white: #FFFFFF;
  
  /* Progress Colors */
  --progress-0: #BDC3C7;
  --progress-25: #F39C12;
  --progress-50: #E67E22;
  --progress-75: #27AE60;
  --progress-100: #3498DB;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background-color: #f8fafc;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.nav {
  display: flex;
  gap: var(--spacing-lg);
}

.nav-link {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--primary);
  background-color: #f1f5f9;
}

.nav-link.active {
  color: var(--primary);
  background-color: #dbeafe;
}

/* Main Layout */
.main {
  padding: var(--spacing-xl) 0;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2xl);
  flex-wrap: wrap;
  gap: var(--spacing-lg);
}

.dashboard-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
}

.stats-summary {
  display: flex;
  gap: var(--spacing-lg);
}

.stat-card {
  background: var(--white);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  min-width: 120px;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--secondary);
  margin-top: var(--spacing-xs);
}

/* Student Grid */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.student-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.student-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.student-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.student-info-header {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.student-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin: 0;
}

.student-department {
  font-size: 0.875rem;
  color: var(--white);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.2);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

.student-rank {
  background: var(--primary);
  color: var(--white);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.overall-progress-bar {
  margin-bottom: var(--spacing-lg);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.progress-label span:first-child {
  font-weight: 500;
}

.progress-label span:last-child {
  font-weight: 600;
  color: var(--primary);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background-color: #e2e8f0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--progress-50), var(--progress-75));
  border-radius: var(--radius-md);
  transition: width 0.3s ease;
}

.course-progress-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.course-progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.course-name {
  font-size: 0.875rem;
  color: var(--secondary);
}

.course-progress-mini {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.mini-progress-bar {
  width: 60px;
  height: 6px;
  background-color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.3s ease;
}

.course-percentage {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--secondary);
  min-width: 35px;
  text-align: right;
}

/* Student Detail */
.student-header {
  margin-bottom: var(--spacing-2xl);
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}

.back-btn:hover {
  background-color: #f1f5f9;
}

.student-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
}

.student-info h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
}

.progress-circle {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 8;
  r: 50;
  cx: 60;
  cy: 60;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-percentage {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  line-height: 1;
}

.progress-text .progress-label {
  font-size: 0.875rem;
  color: var(--secondary);
  margin-top: var(--spacing-xs);
}

/* Course List */
.course-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.course-header {
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--white);
}

.course-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.course-progress-detail {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.course-progress-detail .progress-bar {
  flex: 1;
  height: 8px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  max-height: 200px;
  overflow-y: auto;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.lesson-item:hover {
  background-color: #f8fafc;
  border-color: var(--color-primary);
}

.lesson-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  margin: 0;
}

.lesson-name {
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.lesson-item.completed {
  background-color: #e8f5e8;
  border-color: #4caf50;
  color: #2e7d32;
}

.lesson-item.completed .lesson-name {
  text-decoration: line-through;
  opacity: 0.7;
}

.lesson-name {
  font-size: 0.875rem;
  color: var(--dark);
  user-select: none;
  cursor: pointer;
}

.lesson-item.completed .lesson-name {
  color: var(--secondary);
  text-decoration: line-through;
}

/* Admin Panel */
.admin-tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
  border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
  background: none;
  border: none;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 1rem;
  color: var(--secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab {
  display: none;
}

.admin-tab.active {
  display: block;
}

.admin-section {
  background: var(--white);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-xl);
}

.admin-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--dark);
}

/* 학생별 과목 관리 */
.student-course-management {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.student-selection {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: #f8fafc;
  border-radius: var(--radius-md);
}

.student-selection label {
  font-weight: 600;
  color: var(--dark);
  min-width: 100px;
}

.student-selection select {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 1rem;
}

.student-course-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

.current-courses-section,
.available-courses-section {
  background: #f8fafc;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
}

.current-courses-section h4,
.available-courses-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--dark);
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: var(--spacing-sm);
}

.course-filter {
  margin-bottom: var(--spacing-md);
}

.course-filter select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.course-management-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-height: 400px;
  overflow-y: auto;
}

.course-management-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--white);
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  transition: all 0.2s ease;
}

.course-management-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.course-management-info {
  flex: 1;
}

.course-management-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: var(--spacing-xs);
}

.course-management-code {
  font-size: 0.875rem;
  color: var(--secondary);
}

.course-management-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.btn-add-course,
.btn-remove-course {
  padding: var(--spacing-xs) var(--spacing-md);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-course {
  background: var(--success);
  color: var(--white);
}

.btn-add-course:hover {
  background: #27ae60;
  transform: translateY(-1px);
}

.btn-remove-course {
  background: var(--danger);
  color: var(--white);
}

.btn-remove-course:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

.course-management-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--secondary);
  font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .student-course-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .student-selection {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }
  
  .student-selection label {
    min-width: auto;
  }
}

/* Forms */
.form {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.form input,
.form select {
  flex: 1;
  min-width: 200px;
  padding: var(--spacing-md);
  border: 1px solid #d1d5db;
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form button {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.form button:hover {
  background: var(--primary-dark);
}

/* Lists */
.user-list {
  display: grid;
  gap: var(--spacing-md);
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  background: #f8fafc;
  border-radius: var(--radius-md);
}

.user-name {
  font-weight: 500;
}

.user-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.btn-sm {
  background: var(--secondary);
  color: var(--white);
  border: none;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-sm:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #c0392b;
}

/* Course Tree */
.course-tree {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.course-node {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.course-node-header {
  background: #f8fafc;
  padding: var(--spacing-lg);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.course-node-content {
  padding: var(--spacing-lg);
  display: none;
}

.course-node.expanded .course-node-content {
  display: block;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.lesson-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: #f8fafc;
  border-radius: var(--radius-md);
}

/* Progress Color Classes */
.progress-0 { background-color: var(--progress-0) !important; }
.progress-25 { background-color: var(--progress-25) !important; }
.progress-50 { background-color: var(--progress-50) !important; }
.progress-75 { background-color: var(--progress-75) !important; }
.progress-100 { background-color: var(--progress-100) !important; }

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .stats-summary {
    width: 100%;
    justify-content: space-around;
  }
  
  .student-grid {
    grid-template-columns: 1fr;
  }
  
  .student-info {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .lesson-grid {
    grid-template-columns: 1fr;
  }
  
  .form {
    flex-direction: column;
  }
  
  .form input,
  .form select {
    min-width: unset;
  }
}

@media (max-width: 480px) {
  .header .container {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .nav {
    width: 100%;
    justify-content: center;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Register Page */
.register-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.register-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: var(--spacing-md);
}

.register-header p {
  color: var(--secondary);
  font-size: 1.1rem;
}

.register-form-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-2xl);
}

.register-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.validation-message {
  font-size: 0.875rem;
  margin-top: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.validation-message.success {
  color: var(--success);
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.validation-message.error {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.validation-message.warning {
  color: var(--warning);
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.validation-message:empty {
  display: none;
}

.form-group label {
  font-weight: 600;
  color: var(--dark);
  font-size: 1rem;
}

.register-form input,
.register-form select {
  padding: var(--spacing-md);
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.register-form input:focus,
.register-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.course-selection {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  background: #f8fafc;
}

.course-selection-note {
  color: var(--secondary);
  text-align: center;
  font-style: italic;
}

.course-table-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-md);
}

.grade-section {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.grade-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: var(--spacing-md) var(--spacing-lg);
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.course-table {
  display: flex;
  flex-direction: column;
}

.course-row {
  display: flex;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s ease;
}

.course-row:hover {
  background-color: #f8fafc;
}

.course-row:last-child {
  border-bottom: none;
}

.course-checkbox {
  margin-right: var(--spacing-md);
}

.course-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.course-info {
  flex: 1;
}

.course-name {
  font-weight: 500;
  color: var(--dark);
  margin-bottom: var(--spacing-xs);
}

.course-details {
  font-size: 0.875rem;
  color: var(--secondary);
}

/* Legacy styles for backward compatibility - DEPRECATED */
/* Old course-grid style - replaced by new design above */
/* 
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}
*/

.course-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.course-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.course-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.course-item label {
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  margin: 0;
}

.course-meta {
  font-size: 0.875rem;
  color: var(--secondary);
}

/* 신규 등록 - 현대적인 탭 스타일 */
.department-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.department-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: var(--spacing-lg);
  text-align: center;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: var(--spacing-md);
}

.grade-tabs {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-xl);
  background: #f8fafc;
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
}

.grade-tab {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.grade-tab:hover {
  background: rgba(74, 144, 226, 0.1);
  color: var(--primary);
  transform: translateY(-1px);
}

.grade-tab.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.grade-tab.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary);
}

.grade-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.grade-content.active {
  display: block;
}

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

/* 개선된 과목 카드 레이아웃 */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.course-card {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-lg);
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  transition: all 0.2s ease;
  cursor: pointer;
  margin: var(--spacing-xs);
  min-width: 200px;
  text-align: center;
}

.course-card:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.1);
  transform: translateY(-1px);
}

.course-card:has(input[type="checkbox"]:checked),
.course-card.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.course-checkbox {
  display: none; /* 체크박스 숨김 */
}

.course-info {
  width: 100%;
}

.course-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: var(--spacing-xs);
  line-height: 1.3;
  word-break: keep-all;
  font-size: 0.95rem;
}

.course-card.selected .course-name {
  color: var(--white);
}

.course-details {
  font-size: 0.8rem;
  color: var(--secondary);
  font-weight: 500;
}

.course-card.selected .course-details {
  color: rgba(255, 255, 255, 0.9);
}

/* 모바일 반응형 개선 */
@media (max-width: 768px) {
  .grade-tabs {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
  }
  
  .grade-tab {
    font-size: 0.875rem;
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .course-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .course-card {
    padding: var(--spacing-md);
  }
  
  .department-section {
    padding: var(--spacing-lg);
  }
}

.form-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  margin-top: var(--spacing-lg);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: var(--spacing-md) var(--spacing-2xl);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  min-width: 120px;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.btn-primary:disabled:hover {
  background: #95a5a6;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--secondary);
  border: 2px solid #e2e8f0;
  padding: var(--spacing-md) var(--spacing-2xl);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(-10px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer Styles */
.footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
  padding: var(--spacing-lg) 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-links svg {
  opacity: 0.8;
}

.footer-info {
  color: var(--secondary);
  font-size: 0.875rem;
}

.footer-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-info a:hover {
  color: var(--primary-dark);
}

/* Mobile Footer */
@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    order: 2;
  }
  
  .footer-info {
    order: 1;
  }
}

/* Unified Course Card */
.unified-course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.unified-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.unified-course-card .course-info {
  flex: 1;
}

.unified-course-card .course-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.unified-course-card .course-code {
  font-size: 0.875rem;
  color: var(--secondary);
}

.unified-course-card .progress-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.unified-course-card .progress-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--white);
  font-weight: bold;
  font-size: 0.8rem;
}

.unified-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
}

.unified-lesson-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  background: #f8fafc;
  transition: all 0.2s ease;
}

.unified-lesson-item:hover {
  background: #f1f5f9;
}

.unified-lesson-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.unified-lesson-name {
  font-size: 0.875rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unified-lesson-item.completed {
  background: #e6f4ea;
  color: #34a853;
}

.unified-lesson-item.completed .unified-lesson-name {
  text-decoration: line-through;
  opacity: 0.8;
}

.no-lessons {
  padding: var(--spacing-md);
  color: var(--secondary);
  font-style: italic;
}

/* ===== Student Progress Page (개인 현황) ===== */
.student-selector {
  margin-bottom: var(--spacing-xl);
}

.student-selector label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--dark);
}

.student-selector select {
  width: 100%;
  max-width: 400px;
  padding: var(--spacing-md);
  border: 2px solid var(--light);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background-color: var(--white);
  color: var(--dark);
}

.student-selector select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.student-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-radius: var(--radius-lg);
}

.student-basic-info h2 {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.student-meta {
  display: flex;
  gap: var(--spacing-sm);
}

/* 개인현황 페이지 - 인라인 헤더 스타일 */
.student-info-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-radius: var(--radius-lg);
}

.student-inline-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.student-inline-info h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}

.department-badge-inline {
  font-size: 0.875rem;
  color: var(--white);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.2);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex: 1;
  max-width: 300px;
  justify-content: flex-end;
}

.progress-bar-horizontal {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 150px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--white);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: var(--radius-md);
}

.progress-percentage-inline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  min-width: 45px;
  text-align: right;
}

.department-badge, .rank-badge {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.progress-circle-small {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-circle-small .progress-ring-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 188.4;
  stroke-dashoffset: 188.4;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.5s ease-in-out;
}

.progress-circle-small .progress-text {
  position: absolute;
  text-align: center;
}

.progress-circle-small .progress-percentage {
  font-size: 1rem;
  font-weight: bold;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.course-card-header {
  padding: var(--spacing-md);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--white);
}

.course-card-header h3 {
  margin: 0 0 var(--spacing-xs) 0;
  font-size: 1rem;
  font-weight: 600;
}

.course-code {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: var(--spacing-sm);
}

.course-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.course-progress-fill {
  height: 100%;
  background: var(--white);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.course-card-body {
  padding: var(--spacing-md);
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--spacing-xs);
  max-height: 300px;
  overflow-y: auto;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--light);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.85rem;
}

.lesson-item:hover {
  background: #dfe4ea;
}

.lesson-item.completed {
  background: #e8f5e8;
  color: var(--success);
}

.lesson-item.completed .lesson-name {
  text-decoration: line-through;
  opacity: 0.8;
}

.lesson-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lesson-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
}

.lesson-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 768px) {
  .student-info-header {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-md);
  }
  
  .student-info-header-inline {
    flex-direction: column;
    gap: var(--spacing-lg);
    text-align: center;
  }
  
  .student-inline-info {
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
  }
  
  .progress-bar-container {
    max-width: none;
    width: 100%;
    justify-content: center;
  }
  
  .progress-bar-horizontal {
    min-width: 200px;
  }
  
  .courses-grid {
    grid-template-columns: 1fr;
  }
  
  .lessons-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .course-card-header {
    padding: var(--spacing-md);
  }
  
  .course-card-body {
    padding: var(--spacing-md);
  }
}

/* ===== Skeleton Loading UI ===== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.skeleton-header {
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.skeleton-body {
  padding: var(--spacing-lg);
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 2s infinite;
}

.skeleton-title {
  width: 70%;
  height: 20px;
  margin-bottom: var(--spacing-sm);
}

.skeleton-subtitle {
  width: 40%;
  height: 14px;
  margin-bottom: var(--spacing-sm);
}

.skeleton-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 3px;
}

.skeleton-info {
  width: 60%;
  margin-bottom: var(--spacing-lg);
}

.skeleton-lessons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-sm);
}

.skeleton-lesson {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--light);
  border-radius: var(--radius-sm);
}

.skeleton-checkbox {
  width: 18px;
  height: 18px;
  background: #d0d0d0;
  border-radius: var(--radius-sm);
  animation: shimmer 2s infinite;
}

.skeleton-lesson-name {
  flex: 1;
  height: 14px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Performance optimizations */
.course-card {
  will-change: transform;
}

.lesson-item {
  will-change: background-color, color;
}

.progress-ring-circle {
  will-change: stroke-dashoffset, stroke;
}

.github-link {
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.github-link:hover {
    background-color: #f0f0f0;
}

.version-info {
    margin-left: 10px;
    font-size: 0.8em;
    color: #777;
}