:root {
  --brand: #15574B;
  --brand-light: #1b6a5a;
  --brand-soft: #EAF3F0;
  --ink: #333;
  --muted: #888;
  --line: #e2e8f0;
  --bg: #f7f8fa;
  --card: #fff;
  --danger: #e53e3e;
  --success: #38a169;
  --warning: #d69e2e;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

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

/* Layout */
.navbar {
  background: var(--brand);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand:hover { text-decoration: none; }

.navbar-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 220px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-right a {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}

.navbar-right a:hover { color: #fff; text-decoration: none; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.navbar-user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

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

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--brand);
}

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

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 20px;
  text-align: center;
}

.stat-card .stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Course Cards */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.course-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.course-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.course-card h3 { margin-bottom: 8px; }
.course-card p { color: var(--muted); font-size: 14px; flex: 1; }

.course-card .course-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-assigned { background: #EDF2F7; color: #4A5568; }
.badge-in_progress, .badge-in-progress { background: #FEFCBF; color: #975A16; }
.badge-completed { background: #C6F6D5; color: #276749; }
.badge-admin { background: var(--brand-soft); color: var(--brand); }
.badge-user { background: #EDF2F7; color: #4A5568; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn:hover { text-decoration: none; }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn-outline:hover { background: var(--brand-soft); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c53030; color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #2f855a; color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-google {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.btn-google:hover { background: #f8f8f8; color: #333; }
.btn-google img { width: 20px; height: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 87, 75, 0.1);
}

.form-inline {
  display: flex;
  gap: 8px;
  align-items: end;
}

.form-inline .form-group { margin-bottom: 0; flex: 1; }

/* Login page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
}

.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  max-width: 400px;
  width: 100%;
}

.login-card h1 {
  color: var(--brand);
  margin-bottom: 8px;
  font-size: 24px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 32px;
}

.login-error {
  background: #FED7D7;
  color: #9B2C2C;
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* Course viewer */
.course-viewer {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

.course-toolbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-toolbar h2 { font-size: 16px; }

.course-iframe-wrap {
  flex: 1;
  position: relative;
}

.course-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
}

.module-quiz-wrap {
  flex: 1;
  overflow: auto;
}

.module-action-footer {
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Activity feed */
.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.activity-item:last-child { border-bottom: none; }

.activity-action {
  font-weight: 500;
}

.activity-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error { background: #FED7D7; color: #9B2C2C; }
.alert-success { background: #C6F6D5; color: #276749; }

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input { width: 16px; height: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .course-grid { grid-template-columns: 1fr; }
  .form-inline { flex-direction: column; }
  .login-card { margin: 16px; padding: 32px 24px; }
  .navbar-logo { height: 26px; max-width: 170px; }
  .module-action-footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }
}
