:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #152238;
  --muted: #5a6a85;
  --border: #dfe7f2;
  --primary: #0f4c81;
  --primary-hover: #0a365c;
  --accent: #00897b;
  --success-bg: #e8f7f0;
  --success-text: #0f6b43;
  --success-border: #b5e6cf;
  --error-bg: #fdeeee;
  --error-text: #a61e22;
  --error-border: #f5c2c4;
  --warn-bg: #fff8e6;
  --warn-text: #8a5a00;
  --warn-border: #f3d796;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 34, 66, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.topbar {
  background: linear-gradient(135deg, #0b355c 0%, #0f4c81 60%, #1565a8 100%);
  color: #fff;
  padding: 28px 20px 36px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 6px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 8px 0 0;
  opacity: 0.9;
  max-width: 680px;
  font-size: 15px;
}

main {
  padding: 28px 0 64px;
}

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-top: -22px;
  margin-bottom: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.student-name {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 6px;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.student-meta span strong {
  color: var(--text);
}

.alert {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid transparent;
  font-size: 14.5px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.section-header .count {
  font-size: 14px;
  color: var(--muted);
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 22px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 34, 66, 0.1);
  border-color: #c2d4ea;
}

.course-card.is-enrolled {
  border-color: var(--success-border);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf3fa;
  color: var(--primary);
}

.badge-duration {
  background: #e6f4f1;
  color: #0b6b60;
}

.badge-enrolled {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.course-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.course-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 12px 0 4px;
}

.course-desc {
  margin: 0;
  font-size: 14px;
  color: #33445e;
}

.objectives-details {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.objectives-details summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}

.objectives-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: #3d4f6b;
}

.objectives-list li {
  margin-bottom: 4px;
}

.course-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-success {
  background: var(--accent);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #006e63;
}

.btn-secondary {
  background: #e9eff7;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #dce6f3;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 34, 66, 0.56);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 60px rgba(10, 25, 47, 0.28);
  overflow: hidden;
  animation: modalIn 0.16s ease-out;
}

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

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}

.modal-body {
  padding: 20px 22px;
}

.summary-box {
  background: #f6f9fd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #e8eef7;
}

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

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row span:last-child {
  font-weight: 600;
  text-align: right;
}

.modal-footer {
  padding: 14px 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  max-width: 620px;
  margin: 24px auto;
  box-shadow: var(--shadow);
}

.empty-state h2 {
  margin-top: 0;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
}
