:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

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

.navbar {
  background: #111827;
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.navbar .brand { font-weight: 700; font-size: 1.2rem; color: #fff; display: flex; align-items: center; gap: 10px; }
.navbar .brand:hover { text-decoration: none; }
.navbar .brand-logo { height: 28px; width: auto; display: block; }
.navbar .brand-suffix { font-size: 0.85rem; color: #cbd5e1; font-weight: 500; border-left: 1px solid #374151; padding-left: 10px; }
.navbar nav a {
  color: #cbd5e1;
  margin-left: 18px;
  font-size: 0.95rem;
}
.navbar nav a:hover { color: #fff; text-decoration: none; }
.navbar .user-badge {
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-left: 18px;
}

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

.page-title {
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.page-subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

.course-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); text-decoration: none; }
.course-card .cover {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}
.course-card .body { padding: 16px; flex: 1; }
.course-card .body h3 { margin: 0 0 8px; color: var(--text); font-size: 1.05rem; }
.course-card .body p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.course-card .progress-bar { height: 6px; background: var(--border); }
.course-card .progress-bar span { display: block; height: 100%; background: var(--success); }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn.btn-secondary:hover { background: #cbd5e1; }
.btn.btn-danger { background: var(--danger); }
.btn.btn-success { background: var(--success); }
.btn.btn-sm { padding: 5px 12px; font-size: 0.82rem; }

form.form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
form.form input[type=text],
form.form input[type=email],
form.form input[type=password],
form.form input[type=file],
form.form input[type=number],
form.form textarea,
form.form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-family: inherit;
}
form.form textarea { min-height: 90px; resize: vertical; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table th, table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; }

.video-list { list-style: none; padding: 0; margin: 0; }
.video-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fafbfe;
}
.video-list li.completed { border-color: #bbf7d0; background: #f0fdf4; }
.video-list .video-title { font-weight: 600; }
.video-list .status { font-size: 0.8rem; color: var(--muted); }
.video-list .status.done { color: var(--success); font-weight: 600; }

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 16px;
}
.video-embed iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-active { background: #dcfce7; color: #166534; }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
}
.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.login-box h1 { text-align: center; font-size: 1.4rem; margin-bottom: 24px; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: 10px 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; }

/* Certyfikat */
.certificate {
  background: #fff;
  border: 10px solid #1e3a8a;
  padding: 60px;
  max-width: 900px;
  margin: 20px auto;
  text-align: center;
  position: relative;
}
.certificate::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px solid #cbd5e1;
}
.certificate .cert-logo { max-width: 180px; height: auto; margin-bottom: 20px; }
.certificate .cert-heading { font-size: 2rem; color: #1e3a8a; font-weight: 700; margin-bottom: 6px; letter-spacing: 1px;}
.certificate .cert-sub { color: var(--muted); margin-bottom: 30px; }
.certificate .cert-name { font-size: 2.2rem; font-weight: 700; margin: 20px 0; color: var(--text); font-family: Georgia, serif; }
.certificate .cert-course { font-size: 1.3rem; color: var(--primary); margin-bottom: 30px; }
.certificate .cert-meta { display: flex; justify-content: space-between; margin-top: 50px; font-size: 0.85rem; color: var(--muted); }
.certificate .cert-code { font-family: monospace; letter-spacing: 1px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .certificate { border-color: #1e3a8a !important; box-shadow: none; }
}
