/* ═══════════════════════════════════════════════════════════════
   Cert Builder Pro – Public Portal
   Clean, professional, mobile-first download portal
═══════════════════════════════════════════════════════════════ */

/* ── Reset & base ─────────────────────────────────────────── */
.cb-portal *,
.cb-portal *::before,
.cb-portal *::after { box-sizing: border-box; }

.cb-portal {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Card shell ───────────────────────────────────────────── */
.cb-portal__card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.05),
    0 4px 6px rgba(0,0,0,.05),
    0 20px 40px rgba(0,0,0,.08);
  overflow: hidden;
}

/* ── Header gradient ──────────────────────────────────────── */
.cb-portal__header {
  background: linear-gradient(145deg, #1e40af 0%, #4f46e5 50%, #7c3aed 100%);
  color: #fff;
  padding: 36px 28px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer overlay */
.cb-portal__header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}

.cb-portal__icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.2));
}

.cb-portal__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: -.3px;
  line-height: 1.2;
  position: relative;
}

.cb-portal__desc {
  font-size: 14px;
  margin: 0;
  color: rgba(255,255,255,.82);
  line-height: 1.55;
  position: relative;
}

/* ── Form body ────────────────────────────────────────────── */
.cb-portal__form {
  padding: 28px 28px 24px;
}

/* ── Form groups ─────────────────────────────────────────── */
.cb-form-group {
  margin-bottom: 18px;
  position: relative;
}

.cb-form-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.cb-req {
  color: #ef4444;
  font-size: 14px;
  line-height: 1;
}

/* ── Hint text above form ─────────────────────────────────── */
.cb-portal__hint {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.55;
  margin: 0 0 20px;
  padding: 12px 16px;
  background: #f0f9ff;
  border-left: 3px solid #4f46e5;
  border-radius: 0 8px 8px 0;
}

/* ── Input fields ─────────────────────────────────────────── */
.cb-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: #111827;
  background: #f9fafb;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  margin: 0;
  line-height: 1.5;
}

.cb-input::placeholder { color: #9ca3af; font-size: 14px; }

.cb-input:focus {
  border-color: #4f46e5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
  outline: none;
}

/* Validation states */
.cb-input--valid {
  border-color: #10b981 !important;
  background: #f0fdf4 !important;
  padding-right: 40px;
}

.cb-input--invalid,
.cb-input--error {
  border-color: #ef4444 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.1) !important;
  padding-right: 40px;
}

/* Validation icon inside input */
.cb-input-wrap {
  position: relative;
}

.cb-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}

.cb-input-icon--valid  { color: #10b981; opacity: 1; }
.cb-input-icon--invalid{ color: #ef4444; opacity: 1; }

/* Inline field error message */
.cb-field-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 4px;
}

.cb-field-error--show { display: flex; }

/* ── Submit button ────────────────────────────────────────── */
.cb-portal__btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .2s, transform .1s, box-shadow .2s;
  margin-top: 6px;
  letter-spacing: .01em;
  box-shadow: 0 4px 14px rgba(79,70,229,.35);
}

.cb-portal__btn:hover {
  opacity: .93;
  box-shadow: 0 6px 20px rgba(79,70,229,.45);
  transform: translateY(-1px);
}

.cb-portal__btn:active { transform: scale(.98) translateY(0); box-shadow: none; }

.cb-portal__btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading spinner inside button */
.cb-btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cb-spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes cb-spin { to { transform: rotate(360deg); } }

/* ── Footer ──────────────────────────────────────────────── */
.cb-portal__footer {
  padding: 14px 28px 20px;
  text-align: center;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

.cb-portal__footer p {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ── Alert messages ──────────────────────────────────────── */
.cb-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  animation: cb-slide-in .25s ease;
}

@keyframes cb-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cb-alert__icon { font-size: 18px; flex-shrink: 0; line-height: 1.2; }

.cb-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.cb-alert--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.cb-alert--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* ── Empty / no fields notice ─────────────────────────────── */
.cb-portal-empty {
  text-align: center;
  padding: 20px 14px;
  color: #6b7280;
  font-size: 13px;
}

/* ── Success screen (post-download) ──────────────────────── */
.cb-portal-success {
  padding: 36px 28px;
  text-align: center;
  display: none;
}

.cb-portal-success__icon { font-size: 56px; margin-bottom: 12px; }
.cb-portal-success__title { font-size: 20px; font-weight: 800; margin: 0 0 8px; color: #111827; }
.cb-portal-success__msg   { font-size: 14px; color: #6b7280; margin: 0; }

/* ── Progress bar (optional) ─────────────────────────────── */
.cb-progress {
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.cb-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  width: 0;
  transition: width .3s ease;
  border-radius: 2px;
}

/* ── Responsive (classic) ────────────────────────────────── */
@media (max-width: 520px) {
  .cb-portal { padding: 12px 10px; }
  .cb-portal__header { padding: 28px 20px 22px; }
  .cb-portal__form { padding: 20px 18px; }
  .cb-portal__title { font-size: 19px; }
  .cb-portal__btn { font-size: 15px; padding: 13px; }
  .cb-portal__footer { padding: 12px 18px 16px; }
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT: CLASSIC  (existing header gradient, now namespaced)
═══════════════════════════════════════════════════════════ */
.cb-portal--classic .cb-card--classic {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 4px 6px rgba(0,0,0,.05), 0 20px 40px rgba(0,0,0,.08);
  overflow: hidden;
}
.cb-portal--classic .cb-header--classic {
  background: linear-gradient(145deg, #1e40af 0%, #4f46e5 50%, #7c3aed 100%);
  color: #fff;
  padding: 36px 28px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cb-portal--classic .cb-header--classic::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.cb-portal--classic .cb-portal__logo {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
  filter: brightness(0) invert(1);
}
.cb-portal--classic .cb-portal__icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}
.cb-portal--classic .cb-portal__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: -.3px;
  position: relative;
}
.cb-portal--classic .cb-portal__desc {
  font-size: 14px;
  margin: 0;
  color: rgba(255,255,255,.82);
  line-height: 1.55;
  position: relative;
}
.cb-portal--classic .cb-portal__body { }
.cb-portal--classic .cb-portal__form { padding: 28px 28px 24px; }
.cb-portal--classic .cb-portal__footer {
  padding: 14px 28px 20px;
  text-align: center;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}
.cb-portal--classic .cb-portal__footer p {
  font-size: 12px; color: #9ca3af; margin: 0;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT: MODERN  (two-column split, info left / form right)
═══════════════════════════════════════════════════════════ */
.cb-portal--modern { max-width: 780px; }
.cb-portal--modern .cb-card--modern {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 8px 32px rgba(0,0,0,.1);
  overflow: hidden;
}
.cb-portal--modern .cb-modern__logo-bar {
  background: #fff;
  padding: 18px 28px 0;
  border-bottom: 1px solid #f3f4f6;
}
.cb-portal--modern .cb-logo--modern {
  max-height: 48px;
  max-width: 160px;
  object-fit: contain;
  display: block;
}
.cb-portal--modern .cb-modern__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.cb-portal--modern .cb-modern__left {
  background: linear-gradient(160deg, #1e40af 0%, #4f46e5 60%, #7c3aed 100%);
  padding: 36px 28px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cb-portal--modern .cb-modern__badge {
  font-size: 38px;
  line-height: 1;
}
.cb-portal--modern .cb-modern__title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -.3px;
  line-height: 1.2;
}
.cb-portal--modern .cb-modern__desc {
  font-size: 13.5px;
  color: rgba(255,255,255,.8);
  margin: 0;
  line-height: 1.6;
}
.cb-portal--modern .cb-modern__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cb-portal--modern .cb-modern__steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,.9);
  font-weight: 500;
}
.cb-portal--modern .cb-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cb-portal--modern .cb-modern__right {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
}
.cb-portal--modern .cb-modern__right .cb-portal__form {
  padding: 0;
  flex: 1;
}
.cb-portal--modern .cb-modern__privacy {
  font-size: 11.5px;
  color: #9ca3af;
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
@media (max-width: 640px) {
  .cb-portal--modern { max-width: 480px; }
  .cb-portal--modern .cb-modern__split { grid-template-columns: 1fr; }
  .cb-portal--modern .cb-modern__left { padding: 28px 22px 20px; }
  .cb-portal--modern .cb-modern__right { padding: 24px 22px; }
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT: MINIMAL  (clean card, no gradient header)
═══════════════════════════════════════════════════════════ */
.cb-portal--minimal { max-width: 440px; }
.cb-portal--minimal .cb-card--minimal {
  background: #fff;
  border-radius: 16px;
  border: 1.5px solid #e5e7eb;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.cb-portal--minimal .cb-logo--minimal {
  max-height: 52px;
  max-width: 160px;
  object-fit: contain;
  display: block;
  margin-bottom: 18px;
}
.cb-portal--minimal .cb-minimal__title {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: -.3px;
}
.cb-portal--minimal .cb-minimal__desc {
  font-size: 13.5px;
  color: #6b7280;
  margin: 0 0 20px;
  text-align: center;
  line-height: 1.55;
}
.cb-portal--minimal .cb-portal__form { padding: 0; width: 100%; }
.cb-portal--minimal .cb-minimal__privacy {
  font-size: 11.5px;
  color: #9ca3af;
  margin: 16px 0 0;
  text-align: center;
}
@media (max-width: 480px) {
  .cb-portal--minimal .cb-card--minimal { padding: 24px 18px 18px; }
}

/* Layout tiles are defined in admin.css (uses admin CSS variables) */

/* ── Override theme styles (alta especificidad) ───────────── */
.cb-portal .cb-form-group label {
  display: flex !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  margin-bottom: 6px !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  float: none !important;
  width: auto !important;
}
.cb-portal .cb-input,
.cb-portal input.cb-input {
  display: block !important;
  width: 100% !important;
  padding: 11px 14px !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  color: #111827 !important;
  background: #f9fafb !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  line-height: 1.5 !important;
  height: auto !important;
  float: none !important;
}
.cb-portal input.cb-input:focus {
  border-color: #4f46e5 !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,.15) !important;
  outline: none !important;
}
.cb-portal .cb-input-wrap {
  display: block !important;
  position: relative !important;
  width: 100% !important;
}
