/* ═══════════════════════════════════════════════════════════════
   UMWEKA ACADEMY — Certificate System CSS
═══════════════════════════════════════════════════════════════ */

/* Certificate fonts loaded via <link> in certificate layout head */

/* ── Certificate page wrapper ───────────────────────────────── */
.cert-body {
    background: #0f0f1a;
    min-height: 100vh;
    font-family: 'Sora', sans-serif;
}

/* ── Action bar (no-print) ───────────────────────────────────── */
.cert-action-bar {
    background: rgba(10,14,26,0.95);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}
.cert-action-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cert-action-back {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.cert-action-back:hover { color: #fff; }
.cert-action-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}
.cert-action-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Certificate page (the actual document) ──────────────────── */
.cert-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    padding: 40px 24px 60px;
    flex-wrap: wrap;
}

.cert-page {
    width: 794px; /* A4 landscape equivalent */
    min-height: 562px;
    background: #fff;
    position: relative;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Gold ornament border */
.cert-border-outer {
    position: absolute;
    inset: 10px;
    border: 2px solid #c9a227;
    pointer-events: none;
    z-index: 2;
}
.cert-border-inner {
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(201,162,39,0.4);
    pointer-events: none;
    z-index: 2;
}

/* Corner ornaments */
.cert-corner {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 3;
}
.cert-corner svg { width: 60px; height: 60px; }
.cert-corner.tl { top: 10px; left: 10px; }
.cert-corner.tr { top: 10px; right: 10px; transform: scaleX(-1); }
.cert-corner.bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.cert-corner.br { bottom: 10px; right: 10px; transform: scale(-1); }

/* Background watermark */
.cert-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    font-size: 160px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: #1a3a6b;
    letter-spacing: -8px;
    user-select: none;
}

/* Background gradient stripes */
.cert-bg-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 8px;
    background: linear-gradient(90deg, #1a3a6b, #c9a227, #1a3a6b);
    z-index: 3;
}
.cert-bg-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 8px;
    background: linear-gradient(90deg, #1a3a6b, #c9a227, #1a3a6b);
    z-index: 3;
}

/* Certificate body content */
.cert-body-inner {
    position: relative;
    z-index: 4;
    padding: 48px 64px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 562px;
    box-sizing: border-box;
}

/* Logo / institution */
.cert-institution {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.cert-logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #1a3a6b, #2d5ea8);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.cert-institution-name {
    font-family: 'Sora', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #1a3a6b;
    letter-spacing: -0.3px;
}
.cert-institution-name span { color: #c9a227; }

.cert-institution-tagline {
    font-size: 10px;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 16px;
}

.cert-divider-gold {
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
    margin: 0 auto 20px;
}

/* "Certificate of Completion" headline */
.cert-headline {
    font-family: 'Playfair Display', serif;
    font-size: 13px;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 6px;
    text-align: center;
}

.cert-of-text {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 700;
    color: #1a3a6b;
    margin-bottom: 18px;
    text-align: center;
    line-height: 1.1;
}

.cert-presented-to {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    color: #999;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
}

/* Student name — script / signature style */
.cert-student-name {
    font-family: 'Great Vibes', cursive;
    font-size: 54px;
    color: #1a3a6b;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 10px;
    padding: 0 20px;
}

.cert-name-underline {
    width: 360px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
    margin: 0 auto 18px;
}

.cert-body-text {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    color: #555;
    text-align: center;
    line-height: 1.7;
    max-width: 500px;
    margin-bottom: 16px;
}

/* Course title */
.cert-course-name {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: #1a3a6b;
    text-align: center;
    margin-bottom: 20px;
    padding: 0 20px;
    line-height: 1.3;
}

/* Grade badge */
.cert-grade-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}
.cert-grade-badge {
    background: linear-gradient(135deg, #1a3a6b, #2d5ea8);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 20px;
    border-radius: 100px;
}
.cert-grade-badge.distinction { background: linear-gradient(135deg, #b8860b, #c9a227); }
.cert-grade-badge.merit       { background: linear-gradient(135deg, #5b2d8e, #7c3aed); }
.cert-score-text {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* Footer row */
.cert-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
    gap: 24px;
}

.cert-signature-block {
    text-align: center;
    min-width: 140px;
}
.cert-signature-line {
    width: 140px;
    height: 1px;
    background: #c9a227;
    margin-bottom: 4px;
}
.cert-signature-name {
    font-size: 10px;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.5px;
}
.cert-signature-role {
    font-size: 9px;
    color: #999;
    letter-spacing: 0.5px;
}

.cert-seal-block {
    text-align: center;
    position: relative;
}
.cert-seal {
    width: 80px; height: 80px;
    position: relative;
}
.cert-seal svg { width: 80px; height: 80px; }

.cert-cert-id-block {
    text-align: right;
    min-width: 140px;
}
.cert-id-label {
    font-size: 8px;
    color: #bbb;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.cert-id-value {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    font-family: 'Courier New', monospace;
}
.cert-date-value {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

/* ── QR + Meta sidebar ───────────────────────────────────────── */
.cert-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cert-qr-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}
.cert-qr-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}
.cert-qr-img {
    width: 140px; height: 140px;
    border-radius: 10px;
    background: #fff;
    display: block;
    margin: 0 auto 10px;
}
.cert-qr-id {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}
.cert-qr-note {
    font-size: 10px;
    color: rgba(255,255,255,0.25);
    margin-top: 6px;
    line-height: 1.5;
}

.cert-meta-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 16px;
}
.cert-meta-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cert-meta-item:last-child { border-bottom: none; }
.cert-meta-label { font-size: 10px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.cert-meta-value { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.8); }

/* ── Certificate list (dashboard) ────────────────────────────── */
.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.cert-card {
    background: var(--dark-3);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    display: block;
    transition: all 0.2s;
    position: relative;
}
.cert-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    border-color: rgba(201,162,39,0.3);
}

.cert-card-thumb {
    height: 120px;
    background: linear-gradient(135deg, #1a3a6b 0%, #0d2444 50%, #1a3a6b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.cert-card-thumb::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(201,162,39,0.4);
    pointer-events: none;
}
.cert-card-thumb-text {
    font-family: 'Great Vibes', cursive;
    font-size: 28px;
    color: rgba(201,162,39,0.7);
    text-align: center;
    padding: 0 16px;
    line-height: 1.3;
}

.cert-card-grade {
    position: absolute;
    top: 8px; right: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cert-card-grade.distinction { background: rgba(201,162,39,0.2); color: #c9a227; border: 1px solid rgba(201,162,39,0.3); }
.cert-card-grade.merit       { background: rgba(124,58,237,0.15); color: #c084fc; border: 1px solid rgba(124,58,237,0.3); }
.cert-card-grade.pass        { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }

.cert-card-body { padding: 16px; }
.cert-card-course { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 4px; line-height: 1.4; }
.cert-card-date   { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.cert-card-id     { font-size: 10px; color: rgba(255,255,255,0.25); font-family: monospace; }

/* ── Verification page ───────────────────────────────────────── */
.cv-wrap {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}
.cv-card {
    background: var(--dark-3);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 540px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cv-card.valid::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4ade80, #22c55e);
}
.cv-card.invalid::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f87171, #ef4444);
}
.cv-icon    { font-size: 60px; margin-bottom: 16px; }
.cv-title   { font-family: 'DM Serif Display', serif; font-size: 28px; color: #fff; margin-bottom: 8px; }
.cv-sub     { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; line-height: 1.7; }
.cv-details {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cv-detail-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cv-detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.cv-detail-value { font-size: 14px; font-weight: 600; color: #fff; }
.cv-status-valid   { color: #4ade80; font-size: 13px; font-weight: 700; }
.cv-status-invalid { color: #f87171; font-size: 13px; font-weight: 700; }

/* Search form on verify page */
.cv-search {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.cv-search input {
    flex: 1;
    min-width: 200px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 14px;
    color: #fff;
    font-family: 'Sora', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.cv-search input:focus { border-color: var(--primary); }
.cv-search input::placeholder { color: rgba(255,255,255,0.4); }
.cv-search button {
    padding: 11px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.cv-search button:hover { background: var(--primary-dark); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cert-page    { width: 100%; min-width: 0; }
    .cert-wrapper { padding: 20px 12px 40px; }
    .cert-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .cert-qr-card, .cert-meta-card { flex: 1; min-width: 160px; }
    .cert-student-name { font-size: 40px; }
    .cert-of-text      { font-size: 28px; }
    .cert-body-inner   { padding: 32px 32px 28px; }
}
@media print {
    .cert-action-bar { display: none; }
    .cert-body       { background: #fff; }
    .cert-page       { box-shadow: none; width: 100%; }
    .cert-sidebar    { display: none; }
    .cert-wrapper    { padding: 0; justify-content: center; }
}

/* ── Stage 5 additions ──────────────────────────────────────── */

/* Verify page container */
.cv-container {
    width: 100%;
    max-width: 580px;
}

/* Verify page search header */
.cv-search-header {
    margin-bottom: 32px;
    text-align: center;
}
.cv-heading {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(22px, 4vw, 28px);
    color: #fff;
    margin-bottom: 8px;
    font-weight: 400;
}
.cv-heading-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}
.cv-search-form {
    display: flex;
    gap: 10px;
    max-width: 440px;
    margin: 0 auto;
}
.cv-search-form .cv-search {
    flex: 1;
    min-width: 0;
}
