/* ==========================================================================
   TEAM HSEC — Página de Certificados
   Estilos específicos de /certificados, construidos sobre la morfología y los
   tokens de landing.css (misma paleta, radios, sombras y tipografía).
   ========================================================================== */

/* Pre-paint: evita el parpadeo claro cuando el tema guardado es oscuro */
html.theme-dark-init body { background: #16100e; }

/* --- Enlace activo del navbar (página actual) --- */
.nav__link.is-current { opacity: 1; color: var(--red); }

/* ==========================================================================
   HERO COMPACTO — misma imagen y tinte rojo del landing
   ========================================================================== */
.certs-hero {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  min-height: clamp(320px, 46vh, 440px);
  padding: calc(72px + clamp(28px, 5vw, 60px)) 0 clamp(48px, 6vw, 76px);
  overflow: hidden;
}
.certs-hero__media { position: absolute; inset: 0; z-index: 0; }
.certs-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.certs-hero__tint {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(115deg, rgba(196,20,20,.76) 0%, rgba(196,20,20,.60) 45%, rgba(206,31,31,.46) 100%);
  mix-blend-mode: multiply;
}
body.dark-mode .certs-hero__tint {
  background: linear-gradient(115deg, rgba(98,10,10,.88) 0%, rgba(98,10,10,.78) 45%, rgba(128,14,14,.66) 100%);
}
/* Refuerzo inferior para fundir el hero con el fondo claro */
.certs-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 72px; z-index: 1;
  background: linear-gradient(180deg, transparent, rgba(247,244,239,.7) 60%, var(--bg-page));
  pointer-events: none;
}
body.dark-mode .certs-hero::after {
  background: linear-gradient(180deg, transparent, rgba(22,16,14,.7) 60%, var(--bg-page));
}
.certs-hero__content {
  position: relative; z-index: 2;
  text-align: center; color: #fff;
  max-width: 820px;
}
.certs-hero__content .hero__sub { margin-inline: auto; }
.certs-hero .hero__title { font-size: clamp(2rem, 3.7vw, 3.2rem); }

/* ==========================================================================
   TARJETAS INFORMATIVAS — estilo tarjeta del landing
   ========================================================================== */
.certs-cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px; margin-bottom: clamp(36px, 5vw, 52px);
  list-style: none; padding: 0;
}
.cert-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); padding: 28px;
  box-shadow: 0 14px 40px rgba(31,24,21,.08);
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.cert-card:hover {
  transform: translateY(-4px);
  border-color: rgba(201,153,46,.6);
  box-shadow: 0 24px 60px rgba(31,24,21,.12);
}
.cert-card__ico {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  color: var(--red); background: rgba(196,20,20,.08);
  border: 1px solid rgba(196,20,20,.2);
}
.cert-card h3 { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.cert-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }

/* ==========================================================================
   BUSCADOR
   ========================================================================== */
.search-container {
  max-height: 640px; opacity: 1; overflow: hidden;
  transition: max-height .4s var(--ease), opacity .3s var(--ease),
              margin .4s var(--ease), padding .4s var(--ease);
}
.search-container.collapsed {
  max-height: 0; opacity: 0;
  margin-top: 0 !important; margin-bottom: 0 !important;
  padding-top: 0 !important; padding-bottom: 0 !important;
}
.toggle-search-container { display: flex; justify-content: center; margin: 0 0 clamp(22px, 3vw, 34px); }

.cert-search {
  display: flex; flex-direction: column; gap: 20px; text-align: center;
  max-width: 780px; margin-inline: auto;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); box-shadow: 0 14px 40px rgba(31,24,21,.08);
  padding: clamp(24px, 3.4vw, 36px);
}
.cert-search h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.cert-search h2 em { font-style: normal; color: var(--red); }
.cert-search__help { font-size: 14.5px; color: var(--ink-2); }
.cert-search form { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.cert-search input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--bg-page); border: 1px solid var(--card-border);
  border-radius: var(--r-pill); padding: 13px 20px; min-width: 250px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.cert-search input::placeholder { color: #a89e96; }
.cert-search input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,153,46,.15);
}
.cert-search #search-code { flex-grow: 2; }
.cert-search #search-dni { flex-grow: 1; min-width: 180px; }
body.dark-mode .cert-search input::placeholder { color: #8a8078; }

/* ==========================================================================
   RESULTADO — panel dividido (PDF + ficha)
   ========================================================================== */
.split-verification {
  display: grid; grid-template-columns: 1fr 380px; gap: 26px;
  margin-top: clamp(26px, 4vw, 40px); align-items: start;
  animation: certFadeIn .45s var(--ease);
}
.pdf-visualizer {
  display: flex; flex-direction: column; min-height: 600px; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); box-shadow: 0 14px 40px rgba(31,24,21,.08);
}
.pdf-visualizer iframe { width: 100%; flex: 1 1 auto; min-height: 600px; border: 0; background: #fff; }

.sidebar-info {
  position: sticky; top: 92px; align-self: start;
  display: flex; flex-direction: column; gap: 20px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); box-shadow: 0 14px 40px rgba(31,24,21,.08);
  padding: clamp(24px, 3vw, 30px);
}
.sidebar-info .profile-header {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  border-bottom: 1px solid var(--card-border); padding-bottom: 20px;
}
.sidebar-info .profile-pic {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px;
  color: var(--red); background: rgba(196,20,20,.08);
  border: 1px solid rgba(196,20,20,.25);
}
.sidebar-info .student-name {
  font-size: 16px; font-weight: 800; color: var(--ink);
  text-transform: uppercase; line-height: 1.3;
}
.badge-verified,
.badge-expired {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge-verified { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-expired { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
body.dark-mode .badge-verified { background: rgba(34,197,94,.14); color: #4ade80; border-color: rgba(34,197,94,.35); }
body.dark-mode .badge-expired { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.35); }

.sidebar-info .info-list { display: flex; flex-direction: column; gap: 14px; }
.sidebar-info .info-item { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.sidebar-info .info-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-2); opacity: .85;
}
.sidebar-info .info-value { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.sidebar-info .info-value.code { color: var(--red); font-weight: 800; }
.sidebar-info .info-value.hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px;
  word-break: break-all; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-page-2); color: var(--ink-2); border: 1px solid var(--card-border);
}
.sidebar-info .btn-action { width: 100%; }

/* ==========================================================================
   ERROR — certificado no encontrado
   ========================================================================== */
.search-error {
  max-width: 520px; margin: clamp(26px, 4vw, 40px) auto 0;
  text-align: center; padding: clamp(28px, 4vw, 38px);
  background: var(--card-bg); border: 1px solid rgba(196,20,20,.3);
  border-radius: var(--r-lg); box-shadow: 0 14px 40px rgba(31,24,21,.08);
  animation: certFadeIn .4s var(--ease);
}
.search-error__ico { font-size: 40px; color: var(--red); margin-bottom: 10px; }
.search-error h3 { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.search-error p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin-bottom: 22px; }

@keyframes certFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .certs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .split-verification { grid-template-columns: 1fr; }
  .pdf-visualizer, .pdf-visualizer iframe { min-height: 480px; }
  .sidebar-info { position: static; width: 100%; }
}
@media (max-width: 640px) {
  .certs-cards { grid-template-columns: 1fr; }
  .cert-search input { min-width: 100%; }
  .cert-search #search-code, .cert-search #search-dni { min-width: 100%; }
  .cert-search form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .split-verification, .search-error { animation: none; }
}
