
/* ============================================
   P6: Certificate Pages Styles
   Self-contained — does NOT touch homepage styles
   ============================================ */

.cert-page {
  background: #fafbfa;
  color: #1a2926;
  font-family: 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6ebe5;
  position: sticky;
  top: 0;
  z-index: 50;
}
.cert-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1a2926;
}
.cert-brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0d6e50 0%, #0a4f3a 100%);
  color: #fff;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.cert-brand-name {
  font-weight: 700;
  font-size: 15px;
}
.cert-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cert-header-link,
.cert-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  color: #1a2926;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}
.cert-header-link:hover,
.cert-header-btn:hover {
  border-color: #0d6e50;
  background: #f0f7f4;
  color: #0d6e50;
}
.cert-header-btn.is-copied {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

/* ===== Main / Container ===== */
.cert-main {
  flex: 1;
  padding: 32px 16px 64px;
}
.cert-container {
  max-width: 920px;
  margin: 0 auto;
}

/* ===== Form Card (verify.php input) ===== */
.cert-card {
  background: #fff;
  border: 1px solid #e6ebe5;
  border-radius: 18px;
  padding: 40px 36px;
  box-shadow: 0 4px 20px rgba(15, 30, 25, 0.04);
}
.cert-icon-wrap {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #f0f7f4 0%, #e0f0e8 100%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 36px;
}
.cert-icon-wrap.cert-icon-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
.cert-icon {
  font-size: 40px;
  line-height: 1;
}
.cert-form-title {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.4px;
}
.cert-form-lead {
  text-align: center;
  color: #566560;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 28px;
}
.cert-form { display: block; }
.cert-form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1a2926;
  margin-bottom: 8px;
}
.cert-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cert-form-input {
  flex: 1;
  min-width: 200px;
  padding: 14px 16px;
  border: 1px solid #d8dfdc;
  border-radius: 10px;
  font-size: 15px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 0.5px;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.cert-form-input:focus {
  outline: none;
  border-color: #0d6e50;
  box-shadow: 0 0 0 3px rgba(13, 110, 80, 0.12);
}
.cert-form-submit {
  padding: 14px 24px;
  background: #0d6e50;
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, transform 0.18s;
}
.cert-form-submit:hover {
  background: #0a5a40;
  transform: translateY(-1px);
}
.cert-form-hint {
  font-size: 12px;
  color: #7a8782;
  margin: 10px 0 0;
  text-align: center;
}

.cert-mini-form {
  padding: 24px 28px;
  margin-bottom: 24px;
}
.cert-mini-form .cert-form-inline { display: block; }
.cert-mini-form .cert-icon-wrap { display: none; }

/* ===== Result Card (found cert) ===== */
.cert-result-card {
  padding: 0;
  overflow: hidden;
}
.cert-result-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.cert-result-status-ico {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-weight: 800;
}
.cert-result-body { padding: 32px 36px 36px; }
.cert-result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  background: rgba(22, 163, 74, 0.1);
  border: 2px solid currentColor;
}
.cert-result-error .cert-result-icon {
  background: rgba(220, 38, 38, 0.1);
}
.cert-result-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}
.cert-result-lead {
  text-align: center;
  color: #566560;
  font-size: 14px;
  margin: 0 0 28px;
}
.cert-result-list {
  display: grid;
  gap: 12px;
  background: #f7faf8;
  border: 1px solid #e6ebe5;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 0 0 24px;
}
.cert-result-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed #e6ebe5;
}
.cert-result-row:last-child { border-bottom: 0; }
.cert-result-row dt {
  font-size: 13px;
  color: #7a8782;
  font-weight: 600;
  margin: 0;
}
.cert-result-row dd {
  font-size: 15px;
  font-weight: 600;
  color: #1a2926;
  margin: 0;
}
.cert-result-mono { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.cert-result-code { font-size: 12px; word-break: break-all; color: #566560; }
.cert-result-row-highlight {
  background: #e0f0e8;
  margin: 4px -24px;
  padding: 12px 24px;
  border-radius: 8px;
  border-bottom: 0;
}
.cert-result-row-highlight dd { color: #0a5a40; font-size: 16px; }
.cert-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Buttons ===== */
.cert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.cert-btn-primary {
  background: #0d6e50;
  color: #fff;
}
.cert-btn-primary:hover {
  background: #0a5a40;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(13, 110, 80, 0.28);
}
.cert-btn-outline {
  background: #fff;
  border-color: #d8dfdc;
  color: #1a2926;
}
.cert-btn-outline:hover {
  border-color: #0d6e50;
  color: #0d6e50;
  background: #f0f7f4;
}
.cert-btn-ghost {
  background: transparent;
  color: #566560;
}
.cert-btn-ghost:hover { color: #0d6e50; }
.cert-btn-sm { padding: 8px 14px; font-size: 13px; }

/* ===== Certificate Paper (full display) ===== */
.cert-paper {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(15, 30, 25, 0.08);
  margin-bottom: 24px;
}
.cert-paper-inner {
  position: relative;
  padding: 48px 48px 40px;
  background:
    radial-gradient(circle at 20% 10%, rgba(13, 110, 80, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(13, 110, 80, 0.04) 0%, transparent 50%),
    linear-gradient(135deg, #fefefa 0%, #faf9f3 100%);
  border: 2px solid #d4af37;
  margin: 8px;
}

/* Corner ornaments */
.cert-corner {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 3px solid #d4af37;
}
.cert-corner-tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; }
.cert-corner-tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; }
.cert-corner-bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.cert-corner-br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }

.cert-paper-head {
  text-align: center;
  margin-bottom: 32px;
  padding: 0 0 20px;
  border-bottom: 1px solid #e8e0c5;
}
.cert-logo {
  margin: 0 auto 14px;
}
.cert-logo-mark {
  display: inline-block;
  padding: 8px 16px;
  background: #0d6e50;
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
}
.cert-paper-eyebrow {
  font-size: 12px;
  color: #7a8782;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
.cert-paper-title {
  font-family: 'Playfair Display', 'Noto Sans Thai', serif;
  font-size: 42px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: 1px;
  color: #1a2926;
}
.cert-paper-subtitle {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-style: italic;
  color: #7a8782;
  font-weight: 400;
}

.cert-paper-body {
  text-align: center;
  padding: 8px 0 32px;
}
.cert-paper-lead {
  font-size: 16px;
  color: #3c4e4a;
  margin: 0 0 16px;
  line-height: 1.6;
}
.cert-paper-name {
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 32px;
  background: rgba(212, 175, 55, 0.08);
  border: 2px solid #d4af37;
  border-radius: 4px;
  max-width: 80%;
}
.cert-paper-first,
.cert-paper-last {
  font-family: 'Playfair Display', 'Noto Sans Thai', serif;
  font-size: 32px;
  font-weight: 800;
  color: #1a2926;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.cert-paper-last {
  font-size: 24px;
  color: #3c4e4a;
}
.cert-paper-course {
  font-size: 22px;
  font-weight: 700;
  color: #0d6e50;
  margin: 0 0 20px;
  padding: 0 16px;
}
.cert-paper-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 24px;
}
.cert-paper-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
}
.cert-paper-stat-num {
  font-family: 'Playfair Display', 'Noto Sans Thai', serif;
  font-size: 26px;
  font-weight: 800;
  color: #1a2926;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.cert-paper-stat-num.cert-paper-stat-small { font-size: 16px; }
.cert-paper-stat-label {
  font-size: 12px;
  color: #7a8782;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 2px;
}
.cert-paper-stat-highlight .cert-paper-stat-num { color: #0d6e50; }
.cert-paper-stat-sep {
  color: #d4af37;
  font-size: 24px;
  font-weight: 800;
}
.cert-paper-desc {
  font-size: 14px;
  color: #566560;
  font-style: italic;
  max-width: 600px;
  margin: 16px auto 0;
  line-height: 1.6;
}

.cert-paper-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding-top: 32px;
  border-top: 1px solid #e8e0c5;
}
.cert-paper-meta {
  display: grid;
  gap: 6px;
}
.cert-paper-meta-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
}
.cert-paper-meta-label {
  color: #7a8782;
  min-width: 100px;
}
.cert-paper-meta-val {
  color: #1a2926;
  font-weight: 600;
}
.cert-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; }
.cert-paper-sig {
  text-align: center;
  min-width: 200px;
}
.cert-paper-sig-line {
  width: 200px;
  height: 1px;
  background: #1a2926;
  margin: 0 auto 8px;
}
.cert-paper-sig-name {
  font-family: 'Playfair Display', 'Noto Sans Thai', serif;
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  color: #1a2926;
}
.cert-paper-sig-role {
  font-size: 12px;
  color: #7a8782;
  margin-top: 2px;
}

/* Status stamp on cert (for expired/revoked) */
.cert-paper-stamp {
  position: absolute;
  top: 50%;
  right: 32px;
  transform: translateY(-50%) rotate(-15deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 24px;
  border: 4px solid currentColor;
  border-radius: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  pointer-events: none;
}
.cert-paper-stamp-ico { font-size: 28px; }
.cert-paper-stamp-text { font-size: 16px; }
.cert-paper-stamp-expired { color: #d97706; }
.cert-paper-stamp-revoked { color: #dc2626; }

/* Actions bar */
.cert-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px;
  background: #fff;
  border: 1px solid #e6ebe5;
  border-radius: 14px;
  margin-bottom: 16px;
}
.cert-verify-footer {
  text-align: center;
  font-size: 13px;
  color: #7a8782;
  margin: 16px 0 0;
}
.cert-verify-footer a {
  color: #0d6e50;
  text-decoration: none;
  word-break: break-all;
}
.cert-verify-footer a:hover { text-decoration: underline; }

/* ===== User dashboard (certificates.php) ===== */
.cert-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #f0f7f4 0%, #fff 100%);
  border: 1px solid #e6ebe5;
  border-radius: 16px;
  flex-wrap: wrap;
}
.cert-eyebrow {
  font-size: 14px;
  color: #566560;
  margin-bottom: 4px;
}
.cert-list-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.4px;
  color: #1a2926;
}
.cert-list-lead {
  font-size: 14px;
  color: #566560;
  margin: 0;
  max-width: 480px;
}
.cert-list-stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
}
.cert-list-stat {
  text-align: center;
  display: flex;
  flex-direction: column;
}
.cert-list-stat strong {
  font-size: 32px;
  font-weight: 800;
  color: #1a2926;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cert-list-stat.cert-list-stat-active strong { color: #16a34a; }
.cert-list-stat span {
  font-size: 12px;
  color: #7a8782;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.cert-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.cert-item {
  background: #fff;
  border: 1px solid #e6ebe5;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.cert-item:hover {
  border-color: #0d6e50;
  box-shadow: 0 8px 24px rgba(13, 110, 80, 0.08);
  transform: translateY(-2px);
}
.cert-item-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.cert-item-status-ico {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-size: 12px;
}
.cert-item-body { padding: 18px 20px; flex: 1; }
.cert-item-eyebrow {
  font-size: 11px;
  color: #7a8782;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 4px;
}
.cert-item-course {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.35;
  color: #1a2926;
}
.cert-item-meta {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
}
.cert-item-meta-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
}
.cert-item-meta-row dt {
  color: #7a8782;
  font-weight: 600;
  margin: 0;
  min-width: 70px;
}
.cert-item-meta-row dd {
  color: #1a2926;
  margin: 0;
  font-weight: 500;
}
.cert-item-hours dd strong { color: #0d6e50; }
.cert-item-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
  flex-wrap: wrap;
}
.cert-item-actions .cert-btn { flex: 1; min-width: 120px; }

.cert-empty {
  text-align: center;
  padding: 60px 24px;
}
.cert-empty-title {
  font-size: 22px;
  font-weight: 800;
  margin: 16px 0 8px;
  color: #1a2926;
}
.cert-empty-lead {
  font-size: 15px;
  color: #566560;
  margin: 0 0 24px;
}

/* ===== Footer ===== */
.cert-footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid #e6ebe5;
  background: #fff;
  color: #7a8782;
  font-size: 13px;
}
.cert-footer a {
  color: #0d6e50;
  text-decoration: none;
  font-weight: 600;
}
.cert-footer a:hover { text-decoration: underline; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .cert-header { padding: 10px 14px; }
  .cert-brand-name { display: none; }
  .cert-header-actions { gap: 4px; }
  .cert-header-link, .cert-header-btn { padding: 6px 10px; font-size: 12px; }
  .cert-main { padding: 20px 12px 40px; }
  .cert-card { padding: 24px 20px; border-radius: 14px; }
  .cert-form-title { font-size: 22px; }
  .cert-paper-inner { padding: 32px 24px 28px; margin: 6px; }
  .cert-corner { width: 36px; height: 36px; border-width: 2px; }
  .cert-corner-tl { top: 10px; left: 10px; }
  .cert-corner-tr { top: 10px; right: 10px; }
  .cert-corner-bl { bottom: 10px; left: 10px; }
  .cert-corner-br { bottom: 10px; right: 10px; }
  .cert-paper-title { font-size: 28px; }
  .cert-paper-name { padding: 10px 20px; max-width: 100%; }
  .cert-paper-first { font-size: 24px; }
  .cert-paper-last { font-size: 20px; }
  .cert-paper-course { font-size: 18px; }
  .cert-paper-foot {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .cert-paper-sig { margin: 0 auto; }
  .cert-paper-stamp {
    position: static;
    transform: rotate(-8deg);
    margin: 16px auto 0;
    width: fit-content;
  }
  .cert-result-row { grid-template-columns: 1fr; gap: 4px; }
  .cert-result-row dt { font-size: 12px; }
  .cert-list-head { flex-direction: column; padding: 20px; }
  .cert-list-stats { width: 100%; justify-content: flex-start; gap: 16px; }
  .cert-list-stat strong { font-size: 24px; }
}

/* ===== Print ===== */
@media print {
  .cert-header, .cert-header-actions, .cert-footer, .cert-actions, .cert-verify-footer { display: none !important; }
  .cert-page { background: #fff; }
  .cert-main { padding: 0; }
  .cert-paper { box-shadow: none; border-radius: 0; margin: 0; }
  .cert-paper-inner { border: 2px solid #d4af37; margin: 0; }
  .cert-corner { display: none; }
  body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
