/*!
 * ZITLAS — Expert Certificate Verification (assets/css/certificates.css)
 * Shared across expert-dashboard.html (upload + own certs), cprofile.html
 * (Verified Certificates + ZITLAS Verification modal), and the admin
 * review dashboard. Prefix: cert-. Premium glass cards, orange
 * verification accents, green verified badges.
 */

.cert-section-label { font-size: 13px; font-weight: 800; color: var(--text-sec, #64748B); text-transform: uppercase; letter-spacing: 0.5px; margin: 20px 0 10px; }

.cert-upload-card {
  background: rgba(255,255,255,0.9);
  border: 1.5px dashed rgba(255,153,0,0.4);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.cert-upload-icon { font-size: 30px; margin-bottom: 8px; display: block; }
.cert-upload-title { font-size: 13.5px; font-weight: 800; color: var(--text, #1E293B); margin: 0 0 4px; }
.cert-upload-hint { font-size: 11.5px; color: var(--text-sec, #94A3B8); margin: 0 0 14px; }
.cert-upload-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 13px; cursor: pointer; border: none;
  background: linear-gradient(135deg, #FFA940, #FF7A00);
  color: #fff; font-size: 13.5px; font-weight: 800;
  box-shadow: 0 8px 22px rgba(255,122,0,0.35);
}
.cert-upload-btn:disabled { opacity: 0.6; }
.cert-upload-progress {
  display: none; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: #B35900; margin-top: 10px;
}
.cert-upload-progress.show { display: flex; }
.cert-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,153,0,0.25); border-top-color: #FF7A00;
  animation: certSpin 0.8s linear infinite;
}
@keyframes certSpin { to { transform: rotate(360deg); } }

.cert-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(30,41,59,0.07);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 6px 18px rgba(30,41,59,0.04);
}
.cert-card--rejected { border-color: rgba(229,72,77,0.3); }
.cert-card--pending { border-color: rgba(255,153,0,0.3); }
.cert-card-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.cert-card-icon {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px;
  background: rgba(255,153,0,0.1); display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.cert-card-title { font-size: 13.5px; font-weight: 800; color: var(--text, #1E293B); line-height: 1.35; }
.cert-card-org { font-size: 11.5px; font-weight: 600; color: var(--text-sec, #64748B); margin-top: 2px; }
.cert-status-pill {
  flex-shrink: 0; padding: 4px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; white-space: nowrap;
}
.cert-status-pill--verified { background: rgba(107,165,57,0.14); color: #578A2C; }
.cert-status-pill--pending  { background: rgba(255,153,0,0.14); color: #B35900; }
.cert-status-pill--rejected { background: rgba(229,72,77,0.12); color: #B3261E; }
.cert-kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 5px 0; border-top: 1px solid rgba(30,41,59,0.05); }
.cert-kv-row:first-of-type { border-top: none; }
.cert-kv-row span { color: var(--text-sec, #94A3B8); font-weight: 600; }
.cert-kv-row b { color: var(--text, #1E293B); font-weight: 700; text-align: right; }
.cert-reject-note { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(229,72,77,0.08); font-size: 11.5px; color: #B3261E; font-weight: 600; }
.cert-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.cert-view-btn {
  flex: 1; padding: 9px; border-radius: 11px; cursor: pointer; text-align: center;
  background: rgba(30,41,59,0.04); border: 1px solid rgba(30,41,59,0.1);
  font-size: 12px; font-weight: 700; color: var(--text, #1E293B);
}
.cert-empty { text-align: center; padding: 22px 14px; color: var(--text-sec, #94A3B8); font-size: 12.5px; }

/* ── Verified Expert badge (real, clickable) ── */
.cp-badge--verified { cursor: pointer; border: none; font-family: inherit; }
.cp-badge--verified:active { transform: scale(0.96); }

/* ── View Certificate / ZITLAS Verification modal ── */
.cert-modal-backdrop {
  position: fixed; inset: 0; z-index: 12200;
  background: rgba(15,15,20,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity 0.2s ease;
}
.cert-modal-backdrop.open { opacity: 1; }
.cert-modal-backdrop--fullscreen { padding: 0; }
.cert-modal {
  background: rgba(255,255,255,0.97);
  border-radius: 24px;
  padding: 22px 20px 20px;
  max-width: 400px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
  transform: scale(0.95); transition: transform 0.2s ease;
}
.cert-modal-backdrop.open .cert-modal { transform: scale(1); }
.cert-modal-title { font-size: 16px; font-weight: 800; color: var(--text, #1E293B); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.cert-modal-sub { font-size: 12px; color: var(--text-sec, #64748B); margin: 0 0 16px; }
.cert-verify-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(30,41,59,0.06); }
.cert-verify-row:last-of-type { border-bottom: none; }
.cert-verify-check {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: rgba(107,165,57,0.14); color: #578A2C;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
.cert-verify-label { flex: 1; font-size: 13px; font-weight: 700; color: var(--text, #1E293B); }
.cert-detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 12.5px; }
.cert-detail-row span { color: var(--text-sec, #64748B); font-weight: 600; }
.cert-detail-row b { color: var(--text, #1E293B); font-weight: 700; text-align: right; }
.cert-score-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(107,165,57,0.14); color: #578A2C; font-size: 12px; font-weight: 800;
}
.cert-modal-img { width: 100%; border-radius: 14px; margin-bottom: 14px; max-height: 50vh; object-fit: contain; background: rgba(30,41,59,0.04); }
.cert-modal-close {
  width: 100%; margin-top: 14px; padding: 12px; border-radius: 14px;
  background: rgba(30,41,59,0.06); border: none; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--text, #1E293B);
}

/* ── Certificate VIEWER (Google Drive / WhatsApp style) ──────────────────
   .cert-modal--viewer is a modifier applied only for openViewCertificate();
   openVerificationInfo()'s small info card keeps the original .cert-modal
   sizing above untouched. */
.cert-modal--viewer {
  max-width: min(640px, 94vw);
  width: 100%;
  max-height: 90vh;
  padding: 0;
  overflow: hidden;          /* the STAGE scrolls, not the whole modal —
                                 so the header/footer chrome never scrolls
                                 out of view on a tall certificate */
  display: flex;
  flex-direction: column;
}
.cert-modal--viewer.cert-modal--fullscreen {
  max-width: 100vw; width: 100vw;
  max-height: 100vh; height: 100vh;
  border-radius: 0;
}
.cert-viewer { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.cert-viewer-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(30,41,59,0.06);
}
.cert-viewer-titles { min-width: 0; }
.cert-viewer-titles .cert-modal-title { margin-bottom: 2px; }
.cert-viewer-titles .cert-modal-sub { margin-bottom: 0; }
.cert-viewer-close {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(30,41,59,0.06); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text, #1E293B);
}
.cert-viewer-close:hover { background: rgba(30,41,59,0.12); }

.cert-viewer-stage {
  position: relative;
  flex: 1; min-height: 260px;
  overflow: auto;             /* vertical scroll for a tall certificate */
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(45deg, rgba(30,41,59,0.03) 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(-45deg, rgba(30,41,59,0.03) 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(45deg, transparent 75%, rgba(30,41,59,0.03) 75%) -8px 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, rgba(30,41,59,0.03) 75%) -8px 0/16px 16px,
    #fff;
  touch-action: none;         /* we own pinch/pan gestures ourselves */
}
.cert-modal--viewer .cert-modal-img {
  width: auto; height: auto;
  max-width: 100%; max-height: 100%;
  margin: 0; border-radius: 0;
  background: transparent;
  cursor: zoom-in;
  transition: opacity 0.18s ease;
  will-change: transform;
}
.cert-modal-img--zoomed { cursor: grab; }
.cert-modal--viewer.cert-modal--fullscreen .cert-viewer-stage { min-height: 0; }

.cert-viewer-loading, .cert-viewer-error, .cert-viewer-pdf {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 24px; text-align: center; color: var(--text-sec, #64748B);
  font-size: 13px; font-weight: 600;
}
.cert-viewer-error-icon, .cert-viewer-pdf-icon { font-size: 34px; }
.cert-spinner--lg { width: 30px; height: 30px; border-width: 3px; }

.cert-viewer-footer {
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid rgba(30,41,59,0.06); flex-shrink: 0;
  flex-wrap: wrap;
}
.cert-viewer-action {
  flex: 1; min-width: 140px; padding: 11px; border-radius: 12px; cursor: pointer;
  text-align: center; text-decoration: none;
  background: rgba(30,41,59,0.06); border: none;
  font-size: 12.5px; font-weight: 700; color: var(--text, #1E293B);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.cert-viewer-action:hover { background: rgba(30,41,59,0.1); }
.cert-viewer-action--primary {
  background: linear-gradient(135deg, #FFA940, #FF7A00); color: #fff;
  box-shadow: 0 8px 22px rgba(255,122,0,0.3);
}
.cert-viewer-action--primary:hover { filter: brightness(1.04); }

/* Tablet/desktop: a taller, roomier stage since there's more screen to use */
@media (min-width: 720px) {
  .cert-modal--viewer { max-width: min(760px, 80vw); max-height: 85vh; }
  .cert-viewer-stage { min-height: 420px; }
}

/* ── Toast ── */
.cert-toast {
  position: fixed; left: 50%; bottom: 100px; z-index: 12900;
  transform: translateX(-50%) translateY(12px);
  background: rgba(30,41,59,0.93); color: #fff;
  font-size: 13px; font-weight: 600; padding: 11px 18px; border-radius: 14px;
  max-width: 86vw; text-align: center; line-height: 1.45;
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease;
}
.cert-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .cert-modal-backdrop, .cert-modal, .cert-spinner, .cert-toast { transition: none; animation: none; }
}
