/* ================================================================
   Index Page — AI AC/DC 통합 플랫폼
   Hero, Learner Form, Program Cards, Enrollment History
   ================================================================ */

/* ── Top Navigation ── */
.top-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
}

.nav-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-admin-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-alpha-08);
}

/* ── Page Layout ── */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
  min-height: 100vh;
}

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: var(--space-4xl) var(--space-xl) var(--space-3xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0.04;
  border-radius: var(--radius-xl);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-base);
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

.hero-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-md);
}

.hero-subtitle {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  max-width: 640px;
  margin: 0 auto;
}

/* ── Section ── */
.section {
  margin-bottom: var(--space-3xl);
}

.section-header {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}

.section-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

/* ── Learner Form ── */
.learner-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.form-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 180px;
}

.form-group-btn {
  flex: 0 0 auto;
  min-width: auto;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.required {
  color: var(--danger);
}

.form-input {
  width: 100%;
  padding: var(--space-md) var(--space-base);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1;
  min-height: 48px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
}

.btn-icon {
  font-size: var(--font-size-md);
}

/* ── Program Cards Grid ── */
.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-xl);
}

.program-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.program-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.program-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

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

.program-card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
  line-height: var(--line-height-tight);
}

.program-card-step-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--info-bg);
  color: var(--info);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.program-card-target {
  display: inline-block;
  font-size: var(--font-size-xs);
  color: var(--accent-primary);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
}

.program-card-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
  margin: 0 0 var(--space-lg);
}

.program-card-steps {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.program-card-step-tag {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
}

.program-card-action {
  margin-top: var(--space-lg);
  text-align: right;
}

.program-card-action .btn {
  min-height: 40px;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
}

/* ── Enrollment History ── */
.enrollments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.enrollment-row {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-base) var(--space-xl);
  transition: all var(--transition-fast);
}

.enrollment-row:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.enrollment-info {
  flex: 1;
}

.enrollment-program {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
}

.enrollment-date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.enrollment-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.enrollment-progress-bar {
  width: 120px;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.enrollment-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.enrollment-progress-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.enrollment-status {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.enrollment-status-progress {
  background: var(--info-bg);
  color: var(--info);
}

.enrollment-status-completed {
  background: var(--success-bg);
  color: var(--success);
}

.enrollment-action .btn {
  min-height: 36px;
  padding: var(--space-sm) var(--space-base);
  font-size: var(--font-size-xs);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-text {
  font-size: var(--font-size-base);
  color: var(--text-muted);
}

/* ── Theme Toggle ── */
.theme-toggle {
  position: fixed;
  top: var(--space-base);
  right: var(--space-base);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  font-size: 20px;
  cursor: pointer;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-xl);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  max-width: 360px;
  animation: toastIn 0.3s ease;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-inverse);
  font-size: var(--font-size-sm);
  margin-top: var(--space-md);
}

/* ── Skeleton ── */
.skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton-line {
  height: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.skeleton-line-lg { width: 60%; height: 28px; }
.skeleton-line-md { width: 40%; }
.skeleton-line-sm { width: 25%; }

/* ── Responsive ── */
@media (max-width: 1440px) {
  .page-container {
    max-width: 1200px;
  }
}

@media (max-width: 1024px) {
  .hero {
    padding: var(--space-3xl) var(--space-lg) var(--space-2xl);
  }

  .hero-title {
    font-size: var(--font-size-2xl);
  }

  .programs-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: var(--space-md) var(--space-base);
  }

  .hero {
    padding: var(--space-3xl) var(--space-base) var(--space-2xl);
  }

  .hero-title {
    font-size: var(--font-size-2xl);
  }

  .form-row {
    flex-direction: column;
  }

  .form-group {
    min-width: 100%;
  }

  .programs-grid {
    grid-template-columns: 1fr;
  }

  .enrollment-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .enrollment-progress {
    width: 100%;
  }

  .enrollment-progress-bar {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: var(--space-2xl) var(--space-md) var(--space-xl);
  }

  .hero-title {
    font-size: var(--font-size-xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-sm);
  }

  .btn-primary {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
