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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.nav-brand a {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.nav-brand a:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a { color: var(--gray-700); font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--gray-200);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { border-color: var(--gray-300); color: var(--gray-700); background: white; }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 0;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.125rem; color: var(--gray-500); margin-bottom: 2rem; }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--gray-500); font-size: 0.875rem; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.25rem; }
.stat-present .stat-number { color: var(--success); }
.stat-absent .stat-number { color: var(--danger); }
.stat-pending .stat-number { color: var(--warning); }
.stat-retrial .stat-number { color: var(--info); }

/* Course Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.course-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.course-card h3 { margin-bottom: 0.5rem; }
.course-card p { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 0.75rem; }

.course-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  flex-wrap: wrap;
}

.course-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.course-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.course-info {
  display: flex;
  gap: 2rem;
  margin: 1rem 0;
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}

.table th, .table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.table th { background: var(--gray-100); font-weight: 600; font-size: 0.875rem; }
.table-sm th, .table-sm td { padding: 0.5rem 0.75rem; font-size: 0.875rem; }

/* Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #cffafe; color: #155e75; }
.badge-secondary { background: var(--gray-200); color: var(--gray-500); }

/* Alert */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.875rem;
}

.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Session List */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.session-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--gray-700);
}

.session-link:hover { background: var(--gray-100); text-decoration: none; }
.session-link.highlight { border-left: 3px solid var(--primary); }

/* Forms */
.form { max-width: 700px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.875rem; }

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }

.session-entry {
  padding: 1rem;
  background: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

/* Inline forms */
.inline-form { display: inline-block; }
.attendance-actions { display: flex; gap: 0.25rem; }

/* Retrials */
.retrials-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.retrial-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.retrial-info { margin-bottom: 1rem; }

.retrial-schedule {
  border-top: 1px solid var(--gray-200);
  padding-top: 1rem;
}

.retrial-schedule h4 { margin-bottom: 0.5rem; font-size: 0.875rem; }

.retrial-scheduled {
  border-top: 1px solid var(--gray-200);
  padding-top: 0.75rem;
  font-size: 0.875rem;
}

/* Attendance Card */
.attendance-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.attendance-stats {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

.empty-state p { margin-bottom: 1rem; }

/* Error Page */
.error-page { text-align: center; padding: 3rem; }
.error-page h1 { margin-bottom: 1rem; }
.error-page p { margin-bottom: 1.5rem; color: var(--gray-500); }

/* Sections */
.section { margin: 2rem 0; }
.section h2 { margin-bottom: 0.75rem; }
.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }

/* Card */
.card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

/* Inline invite form */
.inline-invite-form { max-width: 100%; }

/* Team list */
.team-list { list-style: none; padding: 0; }
.team-list li { padding: 0.35rem 0; font-size: 0.875rem; border-bottom: 1px solid var(--gray-100); }

/* Role badge */
.badge-role {
  text-transform: capitalize;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
}

/* Past row */
.row-past { opacity: 0.6; }

/* Text muted */
.text-muted { color: var(--gray-500); font-size: 0.875rem; }

/* Responsive */
@media (max-width: 768px) {
  .navbar { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .nav-links { gap: 0.75rem; flex-wrap: wrap; }
  .container { padding: 1rem; }
  .form-row { flex-direction: column; gap: 0; }
  .course-info { flex-direction: column; gap: 0.5rem; }
}
