/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #aeaeb2;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --border: rgba(0, 0, 0, 0.06);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* ===== Navbar — Frosted Glass ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
}

.logo {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--text);
}

.user-name {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-tertiary);
}

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

.btn-danger:hover {
  background: #ff453a;
  transform: translateY(-1px);
}

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

.btn-success:hover {
  background: #30d158;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #ffb340;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 6px 12px;
}

.btn-ghost:hover {
  background: rgba(0, 113, 227, 0.08);
}

/* ===== Main Content ===== */
main {
  min-height: calc(100vh - 52px - 80px);
  padding: 40px 0;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* ===== Course Cards ===== */
.course-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

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

.course-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.course-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.course-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--accent);
}

/* ===== Alerts ===== */
.error {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.success {
  background: #f0fdf4;
  color: #16a34a;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.875rem;
}

th {
  background: var(--bg);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

td {
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(0, 0, 0, 0.01);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: #dcfce7;
  color: #16a34a;
}

.badge-warning {
  background: #fef3c7;
  color: #d97706;
}

.badge-info {
  background: #dbeafe;
  color: #2563eb;
}

/* ===== Auth Pages ===== */
.auth-container {
  max-width: 400px;
  margin: 60px auto;
}

.auth-container h1 {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ===== Section Titles ===== */
h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--text);
}

/* ===== Dashboard Sections ===== */
section {
  margin-bottom: 48px;
}

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card h3 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.stat-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* ===== Admin Links ===== */
.admin-links {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

/* ===== Actions ===== */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ===== Lesson Content ===== */
.lesson-content {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.7;
  font-size: 1rem;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ===== Lessons List ===== */
.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lessons-list .card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lessons-list h3 {
  font-size: 1rem;
  font-weight: 500;
}

/* ===== Hero Section ===== */
.courses-section {
  padding-top: 20px;
}

.courses-section h2 {
  margin-bottom: 24px;
}

/* ===== Footer ===== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  margin-top: 60px;
}

.footer p {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ===== Page Title ===== */
h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

/* ===== Select ===== */
select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

select:focus {
  border-color: var(--accent);
}

/* ===== Inline Forms ===== */
form[style*="inline"] {
  display: inline-flex;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .navbar-content {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  table {
    font-size: 0.8125rem;
  }

  th, td {
    padding: 8px 12px;
  }
}
