/* ============================================================
   Colab · Validador de Certificados — Design System
   ============================================================ */
:root {
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --bg: #f6f8fb;
  --surface: #ffffff;

  --accent: #0d9488;       /* teal */
  --accent-2: #0ea5e9;     /* cyan  */
  --accent-ink: #0f766e;
  --accent-soft: #ccfbf1;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --danger: #e11d48;

  --grad: linear-gradient(135deg, #0d9488 0%, #0ea5e9 100%);
  --grad-soft: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18), 0 4px 10px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 30px 60px -20px rgba(13, 148, 136, .28), 0 12px 24px -16px rgba(15, 23, 42, .15);

  --radius: 20px;
  --radius-sm: 12px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Resplandor suave de fondo */
  background-image:
    radial-gradient(1200px 600px at 90% -10%, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(13, 148, 136, .10), transparent 55%);
  background-attachment: fixed;
}

h1, h2, h3, .display {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 .4em;
}

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(255, 255, 255, .72);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 26px; width: auto; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--line); }
.brand .tag {
  font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em;
}
.topbar .nav-link {
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.topbar .nav-link:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }

/* ---------- Hero / Home ---------- */
.hero { padding: clamp(40px, 8vw, 88px) 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 36px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 56px; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(13,148,136,.18); }

.hero h1 { font-size: clamp(32px, 5.2vw, 50px); line-height: 1.05; font-weight: 800; }
.hero h1 .grad {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: clamp(16px, 2.2vw, 18.5px); color: var(--muted); max-width: 52ch; margin-top: 6px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.card-pad-lg { padding: clamp(24px, 4vw, 40px); }

/* Tarjeta de búsqueda del hero */
.validate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(24px, 4vw, 36px);
  position: relative; overflow: hidden;
}
.validate-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad);
}
.validate-card h2 { font-size: 20px; }
.validate-card .hint { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.input, input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; padding: 13px 15px; font-size: 15.5px; font-family: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s; outline: none;
}
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px rgba(13,148,136,.14);
}
textarea { resize: vertical; min-height: 84px; }

.code-input {
  text-align: center; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; font-size: 18px; font-family: 'Plus Jakarta Sans', monospace;
}

.row { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row.cols-2 { grid-template-columns: 1fr 1fr; } .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; font-size: 15.5px; font-weight: 700; cursor: pointer;
  padding: 13px 22px; border-radius: 999px; border: 1.5px solid transparent;
  transition: transform .12s ease, box-shadow .2s ease, background .2s, color .2s; text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgba(13,148,136,.7); }
.btn-primary:hover { box-shadow: 0 14px 28px -10px rgba(13,148,136,.8); text-decoration: none; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecdd3; }
.btn-danger:hover { background: #fff1f2; text-decoration: none; }
.btn-sm { padding: 9px 16px; font-size: 14px; }

/* ---------- Feature pills ---------- */
.features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line); padding: 9px 14px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.pill svg { color: var(--accent); }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 500; margin-bottom: 16px; }
.alert-error { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

/* ---------- Validation result ---------- */
.result-wrap { padding: clamp(28px, 5vw, 56px) 0; }
.verify-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--ok-soft); border: 1px solid #a7f3d0; color: #065f46;
  padding: 14px 20px; border-radius: 999px; font-weight: 700; margin-bottom: 26px; width: fit-content;
  animation: pop .5s cubic-bezier(.16,1,.3,1);
}
.verify-banner .check {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ok); color: #fff;
  display: grid; place-items: center; flex: none;
}

.cert-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
}

/* Identidad de color por curso (variables --t-* inyectadas por el servidor) */
.cert-card.themed { position: relative; }
.cert-card.themed::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; z-index: 2;
  background: linear-gradient(90deg, var(--t-from), var(--t-to));
}
.themed .cert-head { background: linear-gradient(135deg, var(--t-soft) 0%, #ffffff 75%); }
.themed .section-title { color: var(--t-ink); }
.themed .course-name { color: var(--t-ink); }
.themed .photo-frame { box-shadow: 0 12px 28px -14px var(--t-accent), var(--shadow); }
.themed .code-chip { background: linear-gradient(135deg, var(--t-from), var(--t-to)); }
.themed .meta-box .v { color: var(--t-ink); }
.cert-head {
  background: var(--grad-soft); border-bottom: 1px solid var(--line);
  padding: clamp(22px, 4vw, 34px); display: grid; gap: 26px; grid-template-columns: 1fr;
}
@media (min-width: 760px) { .cert-head { grid-template-columns: auto 1fr; align-items: center; } }

.photo-frame {
  width: 132px; height: 168px; border-radius: 16px; overflow: hidden; background: #fff;
  border: 4px solid #fff; box-shadow: var(--shadow); margin: 0 auto;
}
@media (min-width: 760px) { .photo-frame { width: 150px; height: 190px; } }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame.placeholder { display: grid; place-items: center; color: var(--muted-2); background: #f1f5f9; }

.person h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.08; margin-bottom: 12px; }
.datalist { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .datalist { grid-template-columns: 1fr 1fr; } }
.data { }
.data .k { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.data .v { font-size: 16px; font-weight: 600; color: var(--ink); }

.cert-body { padding: clamp(22px, 4vw, 34px); }
.section-title {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.course-name { font-size: clamp(20px, 3.4vw, 26px); font-weight: 800; margin-bottom: 8px; }
.course-desc { color: var(--muted); font-size: 15.5px; max-width: 70ch; }

.meta-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 22px; }
@media (min-width: 560px) { .meta-grid { grid-template-columns: repeat(3, 1fr); } }
.meta-box { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.meta-box .k { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.meta-box .v { font-size: 17px; font-weight: 700; color: var(--ink); }

.signatures { display: grid; gap: 26px; grid-template-columns: 1fr; margin-top: 30px; }
@media (min-width: 560px) { .signatures { grid-template-columns: 1fr 1fr; } }
.sig { text-align: center; }
.sig img { height: 120px; width: auto; max-width: 92%; object-fit: contain; margin: 0 auto 2px; display: block; }
.sig .line { height: 1px; background: var(--ink); margin: 0 auto 8px; max-width: 240px; }
.sig .name { font-weight: 700; font-size: 15px; }
.sig .role { color: var(--muted); font-size: 13px; }

.cert-foot {
  border-top: 1px solid var(--line); padding: clamp(20px, 4vw, 28px);
  display: grid; gap: 20px; grid-template-columns: 1fr; align-items: center;
}
@media (min-width: 620px) { .cert-foot { grid-template-columns: auto 1fr; } }
.qr-box { display: flex; align-items: center; gap: 16px; }
.qr-box img { width: 96px; height: 96px; border-radius: 12px; border: 1px solid var(--line); padding: 6px; background: #fff; }
.code-chip {
  font-family: 'Plus Jakarta Sans', monospace; font-weight: 800; letter-spacing: .06em;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; display: inline-block; font-size: 15px;
}
.foot-note { color: var(--muted); font-size: 13.5px; }

/* ---------- Not found ---------- */
.empty-state { text-align: center; padding: clamp(40px, 8vw, 90px) 0; }
.empty-icon {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 24px; display: grid; place-items: center;
  background: #fff1f2; color: var(--danger); box-shadow: var(--shadow);
}
.empty-state h1 { font-size: clamp(24px, 4vw, 32px); }
.empty-state p { color: var(--muted); max-width: 46ch; margin: 0 auto 26px; }
.empty-state .code-chip { background: #fff1f2; color: #be123c; margin-top: 8px; }

/* ---------- Admin ---------- */
.admin-shell { flex: 1; padding: 32px 0 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 26px; margin: 0; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search { display: flex; gap: 10px; }
.search input { min-width: 220px; }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data-table th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #f8fafc; }
table.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #f8fafc; }
.mono { font-family: 'Plus Jakarta Sans', monospace; font-weight: 700; letter-spacing: .03em; color: var(--accent-ink); }
.muted { color: var(--muted); }
.table-empty { text-align: center; padding: 50px 20px; color: var(--muted); }

.login-wrap { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand { justify-content: center; margin-bottom: 20px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge-ok { background: var(--ok-soft); color: #065f46; }

.detail-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .detail-grid { grid-template-columns: 1.4fr .9fr; } }
.qr-panel { text-align: center; }
.qr-panel img { width: 220px; height: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: #fff; }

.kv { display: grid; gap: 14px; }
.kv .item { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.kv .item:last-child { border-bottom: none; }
.kv .item .k { color: var(--muted); font-size: 14px; }
.kv .item .v { font-weight: 600; text-align: right; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; background: #0b1220; color: #cbd5e1; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px; text-align: center; }
.footer-logo { height: 30px; filter: brightness(0) invert(1); opacity: .92; margin-bottom: 16px; }
.footer-text { font-size: 14.5px; max-width: 60ch; margin: 0 auto 8px; color: #e2e8f0; }
.footer-text strong { color: #fff; }
.footer-meta { font-size: 13px; color: #94a3b8; margin: 0 0 6px; }
.footer-mini { font-size: 12.5px; color: #64748b; margin: 0 0 14px; }
.footer-mini code { background: rgba(255,255,255,.08); padding: 2px 7px; border-radius: 6px; color: #cbd5e1; }
.footer-copy { font-size: 12.5px; color: #475569; margin: 0; }

main { flex: 1; }

/* ---------- Animations ---------- */
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise .6s cubic-bezier(.16,1,.3,1) both; }
.rise-1 { animation-delay: .05s; }
.rise-2 { animation-delay: .12s; }
.rise-3 { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
