/* Certificados verificables (v2: sello oficial): tarjeta del curso, hoja para confirmar el nombre y lista en Perfil */

.cert-card { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 14px; }
.cert-card[hidden], .cert-list[hidden] { display: none; }
.cert-head { display: flex; gap: 14px; align-items: flex-start; }
.cert-head h2 { margin: 0; font-family: var(--font-head); font-size: 1.15rem; line-height: 1.25; }
.cert-head p { margin: 4px 0 0; color: var(--ink-2); line-height: 1.5; font-size: .95rem; }
.cert-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--teal-ink); }
.cert-ico svg { width: 24px; height: 24px; }
.cert-head.ok .cert-ico { background: var(--green-bg); color: var(--green); }
.cert-head.warn .cert-ico { background: #fff4d6; color: #9a6400; }
.cert-head.bad .cert-ico { background: var(--red-bg); color: var(--red); }
:root[data-theme="dark"] .cert-head.warn .cert-ico { background: rgba(242, 165, 22, .15); color: var(--gold); }

.cert-meter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cert-meter div { background: var(--paper-2); border-radius: 12px; padding: 10px 8px; text-align: center; }
.cert-meter b { display: block; font-family: var(--font-head); font-size: 1.15rem; }
.cert-meter span { font-size: .76rem; color: var(--ink-3); }

.cert-ready { display: flex; flex-direction: column; gap: 14px; }
.cert-card.ready { background: var(--ink); color: var(--paper); border-color: transparent; }
.cert-card.ready .cert-head p { color: var(--paper); opacity: .85; }
.cert-card.ready .cert-ico { background: rgba(94, 234, 212, .18); color: #5eead4; }
:root[data-theme="dark"] .cert-card.ready .cert-ico { background: rgba(10, 124, 124, .15); color: #0a7c7c; }

.cert-code { display: flex; flex-direction: column; gap: 2px; align-self: flex-start; padding: 8px 14px; border: 1.5px dashed var(--teal-ink); border-radius: 12px; background: var(--paper-2); }
.cert-code span { font-size: .75rem; color: var(--ink-3); }
.cert-code b { font-family: var(--font-head); font-size: 1.15rem; letter-spacing: .06em; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-actions .btn { flex: 1 1 180px; }
.cert-note { margin: 0; font-size: .85rem; color: var(--ink-3); line-height: 1.5; }

.cert-weak { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cert-weak a { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.cert-weak a:hover { border-color: var(--teal); }
.cert-weak b { font-family: var(--font-head); color: #9a6400; flex: none; }
:root[data-theme="dark"] .cert-weak b { color: var(--gold); }

.cert-card.just-issued { animation: cert-pop .5s ease both; }
@keyframes cert-pop { 0% { transform: scale(.97); box-shadow: 0 0 0 0 rgba(15, 163, 163, .45); } 60% { transform: scale(1.01); box-shadow: 0 0 0 12px rgba(15, 163, 163, 0); } 100% { transform: none; } }

/* Hoja para confirmar el nombre */
.cert-dlg { border: 0; padding: 0; background: transparent; width: 100%; max-width: 520px; margin: auto auto 0; max-height: 100dvh; color: var(--ink); }
.cert-dlg::backdrop { background: rgba(11, 37, 69, .5); }
.cert-sheet { background: var(--card); border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; animation: cert-up .28s ease both; }
.cert-sheet .grab { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin-bottom: 6px; }
.cert-sheet h2 { margin: 0; font-family: var(--font-head); font-size: 1.35rem; }
.cert-sheet .muted { margin: 0; line-height: 1.5; }
.cert-sheet label[for="certName"] { font-weight: 600; font-size: .9rem; margin-top: 4px; }
.cert-sheet input[type="text"] { width: 100%; min-height: 48px; font-size: 1rem; }
.cert-check { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; line-height: 1.45; cursor: pointer; }
.cert-check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--teal-ink); }
.cert-small { margin: 0; font-size: .82rem; color: var(--ink-3); }
.cert-sheet .error { margin: 0; }
@keyframes cert-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  .cert-dlg { margin: auto; }
  .cert-sheet { border-radius: 20px; padding-bottom: 22px; }
}

/* Perfil: mis certificados */
.cert-list { margin-bottom: 16px; }
.cert-list h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--font-head); font-size: 1.1rem; }
.cert-list h2 svg { width: 22px; height: 22px; color: var(--teal-ink); }
.cert-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cert-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.cert-list a:hover { border-color: var(--teal); }
.cert-list .t { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.cert-list small { font-weight: 400; color: var(--ink-3); font-size: .8rem; }
.cert-list .nw { white-space: nowrap; }
.cert-list a svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.cert-card .btn svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .cert-card.just-issued, .cert-sheet { animation: none; }
}

/* Sello oficial (assets/img/sello-certificado.webp) */
.cert-head.seal .cert-ico, .cert-card.ready .cert-head.seal .cert-ico { width: 56px; height: 56px; background: none; border-radius: 0; }
.cert-head.seal .cert-ico img { width: 56px; height: 56px; display: block; filter: drop-shadow(0 2px 6px rgba(11, 37, 69, .25)); }
