:root {
  --primary: #0070f3;
  --primary-light: #3291ff;
  --primary-dark: #0050b3;
  --secondary: #4b5563;
  --background: #ffffff;
  --surface: #f7f9fc;
  --surface-light: #fcfdff;
  --error: #dc2626;
  --success: #16a34a;
  --border-radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.08);
  --border-color: #eaedf2;
  --transition: all 0.2s ease;
}

/* Modern layout system */
body {
  display: grid;
  grid-template-columns: [sidebar] 280px [main] 1fr;
  grid-template-rows: [header] 72px [content] 1fr;
  min-height: 100vh;
  margin: 0;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--background);
  color: #1f2937;
  line-height: 1.6;
}

/* Header styling */
header {
  grid-column: main;
  grid-row: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background);
  z-index: 10;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
}

nav {
  grid-column: sidebar;
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 5;
  flex-shrink: 0;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
  margin-bottom: 1rem;
  font-weight: 600;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  margin-bottom: 0.5rem;
}

nav a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

nav a:hover, nav a.active {
  background-color: rgba(0, 112, 243, 0.08);
  color: var(--primary);
}

nav a i {
  margin-right: 0.75rem;
}

/* Modern card design */
.card {
  background: var(--background);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

/* Only stretch cards to equal heights in grid/row contexts */
.course-grid .card,
.row .card.h-100,
[class*="row-cols"] .card {
  height: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  z-index: 2;
  position: relative;
}

.card h5 {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--secondary);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

/* Main content area */
main {
  grid-column: main;
  grid-row: content;
  background: var(--surface-light);
  min-height: calc(100vh - 72px);
  padding-bottom: 3rem;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
}

/* Dashboard header */
.dashboard-header {
  background: var(--surface);
  padding: 2.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.dashboard-header p {
  color: var(--secondary);
  margin-bottom: 1.5rem;
  max-width: 600px;
}

/* Course grid layout */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  padding: 0 2.5rem;
}

/* Container for regular content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

/* Modern button styles */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline-primary:hover {
  background: rgba(0, 112, 243, 0.08);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  border: none;
}

.btn-secondary:hover {
  background: #374151;
  transform: translateY(-2px);
}

/* Footer styling */
footer {
  grid-column: main;
  padding: 1.5rem 2.5rem;
  text-align: center;
  color: var(--secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Progress indicators */
.progress-ring {
  width: 48px;
  height: 48px;
}

.progress-ring__circle {
  stroke: var(--primary);
  transition: stroke-dashoffset 0.35s;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Endpoint styling */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.endpoint {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.endpoint .method {
  display: inline-block;
  background: #4338ca;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
}

.endpoint code {
  font-family: 'SF Mono', monospace;
  font-size: 1rem;
  color: #111;
}

.endpoint p {
  margin: 0.5rem 0;
  color: var(--secondary);
}

/* Animation for interactions */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Accessibility enhancements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #3291ff;
    --primary-dark: #2378df;
    --background: #111827;
    --surface: #1f2937;
    --surface-light: #111827;
    --secondary: #9ca3af;
    --border-color: #374151;
  }
  
  body {
    color: #f3f4f6;
  }
  
  .card {
    border-color: #374151;
  }

  header, .dashboard-header {
    border-color: #374151;
  }

  nav a {
    color: #d1d5db;
  }

  nav a:hover, nav a.active {
    background-color: rgba(50, 145, 255, 0.15);
  }

  .endpoint {
    background: #1f2937;
    border-color: #374151;
  }

  .endpoint code {
    color: #e5e7eb;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  nav {
    grid-column: 1;
    grid-row: 2;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  header {
    grid-column: 1;
    grid-row: 1;
  }

  main {
    grid-column: 1;
    grid-row: 3;
  }

  .course-grid {
    grid-template-columns: 1fr;
  }
}