/* ═══════════════════════════════════════════════════════
   Course card enhancements
   ═══════════════════════════════════════════════════════ */

.course-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.course-header:hover { background: rgba(255,255,255,0.03); }

.course-start-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  padding: 9px 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: var(--head);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.course-start-btn:hover {
  background: #00ffcc;
  box-shadow: 0 4px 14px rgba(0,212,170,0.3);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════
   Certificate Modal
   ═══════════════════════════════════════════════════════ */

#cert-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cert-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
}

.cert-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.cert-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  background: #1e2738;
  border: 1px solid #2a3550;
  color: #8899bb;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.cert-close:hover { color: #f76f6f; background: rgba(247,111,111,0.1); }

/* The printable paper */
.cert-paper {
  background: #fffdf8;
  color: #1a1a2e;
  width: min(660px, 92vw);
  padding: 44px 52px;
  border-radius: 6px;
  border: 10px solid #0f1520;
  box-shadow: 0 0 0 2px rgba(0,212,170,0.5), 0 24px 80px rgba(0,0,0,0.8);
  position: relative;
  font-family: Georgia, 'Times New Roman', serif;
}

.cert-paper::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1.5px solid rgba(0,180,140,0.4);
  border-radius: 1px;
  pointer-events: none;
}

.cert-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.cert-logo-chip {
  width: 30px;
  height: 30px;
  background: #00d4aa;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #080b10;
}

.cert-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f1520;
  letter-spacing: -0.02em;
}

.cert-stamp {
  text-align: center;
  font-size: 0.72rem;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: #777;
  margin-bottom: 16px;
}

.cert-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #00d4aa 30%, #4f8ef7 70%, transparent);
  margin-bottom: 22px;
}

.cert-awarded {
  text-align: center;
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 10px;
  font-style: italic;
}

.cert-name-input {
  display: block;
  width: 100%;
  text-align: center;
  font-family: 'Georgia', serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: #0f1520;
  border: none;
  border-bottom: 2px dashed #bbb;
  background: transparent;
  outline: none;
  padding: 4px 0 8px;
  margin-bottom: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.cert-name-input:focus { border-bottom-color: #00d4aa; }
.cert-name-input::placeholder { color: #bbb; font-style: italic; font-size: 1.3rem; font-weight: 400; }

.cert-body {
  text-align: center;
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 18px;
  line-height: 1.6;
}
.cert-body strong { color: #0f1520; }

.cert-course-name {
  text-align: center;
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f1520;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}

.cert-subtitle {
  text-align: center;
  font-size: 0.68rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 20px;
  font-family: sans-serif;
}

.cert-chapters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-bottom: 24px;
}

.cert-chip {
  font-size: 0.68rem;
  padding: 3px 10px;
  background: rgba(0,180,140,0.08);
  border: 1px solid rgba(0,180,140,0.35);
  border-radius: 20px;
  color: #007a60;
  font-family: sans-serif;
}

.cert-date-row {
  text-align: center;
  margin-bottom: 22px;
}

.cert-date-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #999;
  font-family: sans-serif;
  margin-bottom: 3px;
}

.cert-date {
  font-size: 0.95rem;
  color: #333;
  font-weight: 600;
}

.cert-footer {
  border-top: 1px solid #ddd;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.cert-sig {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  color: #0f1520;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.cert-sig-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #999;
  font-family: sans-serif;
}

.cert-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cert-name-hint {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.cert-download-btn {
  padding: 11px 30px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: var(--head);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}
.cert-download-btn:hover {
  background: #00ffcc;
  box-shadow: 0 6px 22px rgba(0,212,170,0.35);
  transform: translateY(-1px);
}

/* ── Print: show only the certificate paper ── */
@media print {
  body * { visibility: hidden !important; }
  #cert-paper,
  #cert-paper * { visibility: visible !important; }
  #cert-paper {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 48px 64px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }
  .cert-paper::before { border-color: rgba(0,180,140,0.25) !important; }
  .cert-name-input { border-bottom-style: solid !important; border-bottom-color: #aaa !important; }
}

@media (max-width: 768px) {
  .cert-paper { padding: 28px 24px; }
  .cert-course-name { font-size: 1.15rem; }
  .cert-name-input { font-size: 1.4rem; }
  .course-start-btn { padding: 7px 14px; font-size: 0.75rem; }
}
