/* Verify certificate page (resources/views/frontend/certificate_verify.blade.php
   and partials/certificate_view.blade.php). Everything is scoped to .vc-page.
   The one memorable element is the guilloche seal: it draws itself on load,
   turns while a certificate is checked, and resolves into a check or a cross. */

.vc-page {
    --vc-gold: var(--theme-color, #af990a);
    --vc-gold-deep: color-mix(in srgb, var(--vc-gold) 70%, #2a2300);
    --vc-gold-soft: color-mix(in srgb, var(--vc-gold) 14%, #fff);
    --vc-ink: #1b2a20;
    --vc-ink-2: #44524a;
    --vc-muted: #6b766f;
    --vc-line: #e4e7e2;
    --vc-paper: #ffffff;
    --vc-panel: #15231a;
    --vc-ok: #1f7a46;
    --vc-ok-soft: #e7f5ec;
    --vc-bad: #b42318;
    --vc-bad-soft: #fdecea;
    --vc-radius: 20px;
    --vc-ease: cubic-bezier(.2, .8, .2, 1);
    color: var(--vc-ink);
    padding: 56px 0 80px;
}

/* ── Lookup card: seal panel + form ─────────────────────────────────── */
.vc-card {
    display: grid;
    grid-template-columns: minmax(260px, 5fr) 7fr;
    background: var(--vc-paper);
    border: 1px solid var(--vc-line);
    border-radius: var(--vc-radius);
    overflow: hidden;
    box-shadow: 0 30px 60px -40px rgba(21, 35, 26, .45);
}
.vc-seal-panel {
    position: relative;
    display: grid;
    place-items: center;
    padding: 44px 32px;
    background:
        radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .07), transparent 60%),
        var(--vc-panel);
    isolation: isolate;
}
.vc-seal-panel::after {
    /* fine engraving lines, like security paper */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .14;
    background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(255, 255, 255, .35) 9px 10px);
    -webkit-mask: radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 80%);
            mask: radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 80%);
}

.vc-seal { width: min(100%, 280px); aspect-ratio: 1; color: var(--vc-gold); }
.vc-seal svg { width: 100%; height: 100%; overflow: visible; display: block; }
.vc-seal .vc-rosette path,
.vc-seal .vc-ring { fill: none; stroke: currentColor; }
.vc-seal .vc-rosette path { stroke-width: .9; opacity: .55; }
.vc-seal .vc-ring { stroke-width: 1.4; }
.vc-seal .vc-ring--dash { stroke-dasharray: 2 5; stroke-width: 2.2; }
.vc-seal .vc-seal-text { fill: currentColor; font-size: 9.5px; font-weight: 800; letter-spacing: 3.2px; }
.vc-seal .vc-core { fill: rgba(255, 255, 255, .04); stroke: currentColor; stroke-width: 1.6; }
.vc-seal .vc-mark { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 120; stroke-dashoffset: 120; }
.vc-seal .vc-mark--ok { stroke: currentColor; }
.vc-seal .vc-mark--bad { stroke: #e9a39b; }
.vc-seal .vc-idle-icon { fill: currentColor; opacity: .9; transition: opacity .3s var(--vc-ease), transform .3s var(--vc-ease); transform-origin: 140px 140px; }
.vc-seal .vc-spin { transform-origin: 140px 140px; }

/* draws itself once on load */
.vc-seal .vc-rosette path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: vc-draw 2.2s var(--vc-ease) forwards; }
.vc-seal .vc-rosette path:nth-child(2n) { animation-delay: .15s; }
.vc-seal .vc-ring { stroke-dasharray: 900; stroke-dashoffset: 900; animation: vc-draw 1.6s var(--vc-ease) .2s forwards; }
.vc-seal .vc-ring--dash { stroke-dasharray: 2 5; stroke-dashoffset: 0; opacity: 0; animation: vc-fade .8s ease 1s forwards; }
.vc-seal .vc-seal-text { opacity: 0; animation: vc-fade .8s ease 1.2s forwards; }
@keyframes vc-draw { to { stroke-dashoffset: 0; } }
@keyframes vc-fade { to { opacity: 1; } }

/* checking: the outer rings turn, the core breathes */
.vc-page.is-checking .vc-spin { animation: vc-turn 2.4s linear infinite; }
.vc-page.is-checking .vc-spin--rev { animation-direction: reverse; animation-duration: 3.6s; }
.vc-page.is-checking .vc-idle-icon { opacity: .35; transform: scale(.9); animation: vc-breathe 1.2s ease-in-out infinite; }
@keyframes vc-turn { to { transform: rotate(360deg); } }
@keyframes vc-breathe { 50% { opacity: .8; } }

/* valid: gold check */
.vc-page.is-valid .vc-idle-icon,
.vc-page.is-invalid .vc-idle-icon { opacity: 0; transform: scale(.6); }
.vc-page.is-valid .vc-mark--ok { animation: vc-draw .6s var(--vc-ease) .1s forwards; }
.vc-page.is-valid .vc-seal { animation: vc-stamp .5s var(--vc-ease); }
@keyframes vc-stamp { 0% { transform: scale(1); } 40% { transform: scale(.94); } 100% { transform: scale(1); } }

/* invalid: the seal loses its colour, a cross is drawn */
.vc-page.is-invalid .vc-seal { color: #8e958f; animation: vc-shake .45s ease; }
.vc-page.is-invalid .vc-mark--bad { animation: vc-draw .5s var(--vc-ease) .1s forwards; }
.vc-page.is-invalid .vc-mark--bad + .vc-mark--bad { animation-delay: .3s; }
@keyframes vc-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ── Form ───────────────────────────────────────────────────────────── */
.vc-form-side { padding: 48px 52px; display: flex; flex-direction: column; justify-content: center; }
.vc-title { font-size: clamp(26px, 3.2vw, 36px); font-weight: 800; line-height: 1.15; margin: 0 0 12px; color: var(--vc-ink); text-wrap: balance; }
.vc-lead { font-size: 16px; line-height: 1.6; color: var(--vc-ink-2); margin: 0 0 30px; max-width: 52ch; }
.vc-label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; color: var(--vc-ink); }
.vc-field { display: flex; gap: 10px; align-items: stretch; }
.vc-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 56px;
    padding: 0 18px;
    border: 1.5px solid var(--vc-line);
    border-radius: 14px;
    font-size: 16px;
    color: var(--vc-ink);
    background: #fbfcfa;
    font-variant-numeric: tabular-nums;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.vc-input::placeholder { color: #9aa39d; }
.vc-input:hover { border-color: #cdd3cc; }
.vc-input:focus { outline: none; border-color: var(--vc-gold); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--vc-gold) 22%, transparent); }
.vc-input[aria-invalid="true"] { border-color: var(--vc-bad); box-shadow: 0 0 0 4px rgba(180, 35, 24, .12); }
.vc-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 132px;
    height: 56px;
    padding: 0 26px;
    border: 0;
    border-radius: 14px;
    background: var(--vc-gold);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
}
.vc-btn:hover { background: var(--vc-gold-deep); box-shadow: 0 10px 22px -12px var(--vc-gold-deep); }
.vc-btn:active { transform: translateY(1px); }
.vc-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--vc-gold) 45%, #fff); outline-offset: 3px; }
.vc-btn[disabled] { cursor: progress; opacity: .92; }
.vc-btn .vc-spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: vc-turn .7s linear infinite; }
.vc-page.is-checking .vc-btn .vc-spinner { display: inline-block; }
.vc-hint { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--vc-muted); }
.vc-hint code { font-size: 12.5px; color: var(--vc-ink-2); background: #f3f5f1; padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.vc-error { margin: 10px 0 0; font-size: 14px; font-weight: 600; color: var(--vc-bad); }
.vc-error:empty { display: none; }

/* ── Result region ──────────────────────────────────────────────────── */
.vc-result { margin-top: 28px; }
.vc-result:empty { display: none; }
.vc-enter { animation: vc-rise .55s var(--vc-ease) both; }
.vc-enter-2 { animation: vc-rise .55s var(--vc-ease) .12s both; }
@keyframes vc-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* checking: a placeholder certificate with a scan line */
.vc-skel { display: grid; grid-template-columns: 3fr 2fr; gap: 28px; padding: 28px; background: var(--vc-paper); border: 1px solid var(--vc-line); border-radius: var(--vc-radius); }
.vc-skel-doc { position: relative; aspect-ratio: 1.414; border-radius: 12px; overflow: hidden; background: linear-gradient(#f4f6f2, #eef1ec); border: 1px solid var(--vc-line); }
.vc-skel-doc::before { content: ""; position: absolute; inset: 14px; border: 2px solid #e1e5df; border-radius: 6px; }
.vc-skel-doc::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: -30%;
    height: 30%;
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--vc-gold) 28%, transparent) 70%, color-mix(in srgb, var(--vc-gold) 60%, transparent));
    border-bottom: 2px solid var(--vc-gold);
    animation: vc-scan 1.4s ease-in-out infinite;
}
@keyframes vc-scan { to { top: 100%; } }
.vc-skel-lines { display: grid; align-content: center; gap: 14px; }
.vc-skel-line { height: 14px; border-radius: 8px; background: linear-gradient(90deg, #eef1ec 25%, #f8f9f7 50%, #eef1ec 75%); background-size: 200% 100%; animation: vc-shimmer 1.2s linear infinite; }
.vc-skel-line:nth-child(1) { width: 40%; height: 12px; }
.vc-skel-line:nth-child(2) { width: 85%; height: 22px; }
.vc-skel-line:nth-child(3) { width: 70%; }
.vc-skel-line:nth-child(4) { width: 90%; }
.vc-skel-line:nth-child(5) { width: 60%; }
@keyframes vc-shimmer { to { background-position: -200% 0; } }

/* valid */
.vc-valid { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; padding: 28px; background: var(--vc-paper); border: 1px solid var(--vc-line); border-radius: var(--vc-radius); box-shadow: 0 30px 60px -45px rgba(21, 35, 26, .5); }
.vc-doc { position: relative; margin: 0; border-radius: 12px; overflow: hidden; background: #f4f6f2; border: 1px solid var(--vc-line); min-height: 220px; }
.vc-doc a { display: block; }
.vc-doc img { display: block; width: 100%; height: auto; opacity: 0; transform: scale(.985); transition: opacity .6s var(--vc-ease), transform .8s var(--vc-ease); }
.vc-doc.is-loaded img { opacity: 1; transform: none; }
.vc-doc embed { display: block; width: 100%; height: 480px; border: 0; }
.vc-doc-skel { position: absolute; inset: 0; background: linear-gradient(90deg, #eef1ec 25%, #f8f9f7 50%, #eef1ec 75%); background-size: 200% 100%; animation: vc-shimmer 1.2s linear infinite; transition: opacity .4s ease; }
.vc-doc.is-loaded .vc-doc-skel { opacity: 0; pointer-events: none; }
.vc-doc::after {
    /* one light sweep across the certificate once it has loaded */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .65) 50%, transparent 65%);
    transform: translateX(-120%);
    pointer-events: none;
}
.vc-doc.is-loaded::after { animation: vc-sweep 1.1s var(--vc-ease) .25s; }
@keyframes vc-sweep { to { transform: translateX(120%); } }

.vc-facts { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.vc-status { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 14px 6px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.vc-status svg { width: 18px; height: 18px; flex: 0 0 auto; }
.vc-status--ok { color: var(--vc-ok); background: var(--vc-ok-soft); }
.vc-status--bad { color: var(--vc-bad); background: var(--vc-bad-soft); }
.vc-awarded { margin: 18px 0 2px; font-size: 14px; color: var(--vc-muted); }
.vc-name { margin: 0 0 6px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; line-height: 1.2; color: var(--vc-ink); overflow-wrap: anywhere; }
.vc-course { margin: 0 0 22px; font-size: 16px; line-height: 1.5; color: var(--vc-ink-2); }
.vc-course strong { color: var(--vc-ink); }
.vc-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 18px; margin: 0 0 26px; padding: 18px 0 0; border-top: 1px solid var(--vc-line); font-size: 15px; }
.vc-dl dt { color: var(--vc-muted); font-weight: 600; }
.vc-dl dd { margin: 0; color: var(--vc-ink); font-weight: 700; min-width: 0; }
.vc-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vc-id span { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.vc-copy {
    display: inline-flex; align-items: center; gap: 5px;
    min-height: 32px; padding: 0 10px;
    border: 1px solid var(--vc-line); border-radius: 8px; background: #fff;
    font-size: 13px; font-weight: 700; color: var(--vc-ink-2); cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.vc-copy:hover { border-color: var(--vc-gold); color: var(--vc-gold-deep); }
.vc-copy:focus-visible { outline: 3px solid color-mix(in srgb, var(--vc-gold) 40%, #fff); outline-offset: 2px; }
.vc-copy.is-done { color: var(--vc-ok); border-color: color-mix(in srgb, var(--vc-ok) 40%, #fff); background: var(--vc-ok-soft); }
.vc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.vc-link-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 20px; border-radius: 12px;
    font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.vc-link-btn--solid { background: var(--vc-gold); color: #fff; border: 1.5px solid var(--vc-gold); }
.vc-link-btn--solid:hover { background: var(--vc-gold-deep); border-color: var(--vc-gold-deep); color: #fff; }
.vc-link-btn--ghost { background: #fff; color: var(--vc-ink); border: 1.5px solid var(--vc-line); }
.vc-link-btn--ghost:hover { border-color: var(--vc-gold); color: var(--vc-gold-deep); }
.vc-link-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--vc-gold) 45%, #fff); outline-offset: 2px; }

/* invalid */
.vc-invalid { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; padding: 30px; background: var(--vc-paper); border: 1px solid var(--vc-line); border-left: 4px solid var(--vc-bad); border-radius: var(--vc-radius); }
.vc-invalid-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--vc-bad-soft); color: var(--vc-bad); }
.vc-invalid-icon svg { width: 26px; height: 26px; }
.vc-invalid li { list-style: inherit; }
.vc-invalid h3 { margin: 0 0 6px; font-size: 22px; font-weight: 800; color: var(--vc-ink); }
.vc-invalid p { margin: 0 0 12px; color: var(--vc-ink-2); line-height: 1.6; overflow-wrap: anywhere; }
.vc-invalid ul { list-style: disc; margin: 0 0 20px; padding-left: 20px; color: var(--vc-ink-2); line-height: 1.7; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .vc-card { grid-template-columns: 1fr; }
    .vc-seal-panel { padding: 30px 24px; }
    .vc-seal { width: 170px; }
    .vc-form-side { padding: 34px 32px 38px; }
    .vc-valid, .vc-skel { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .vc-page { padding: 32px 0 56px; }
    .vc-card, .vc-valid, .vc-skel, .vc-invalid { border-radius: 16px; }
    .vc-seal { width: 140px; }
    .vc-form-side { padding: 26px 20px 30px; }
    .vc-lead { font-size: 15px; margin-bottom: 22px; }
    .vc-field { flex-direction: column; }
    .vc-btn { width: 100%; }
    .vc-valid, .vc-skel { padding: 16px; gap: 20px; }
    .vc-doc embed { height: 360px; }
    .vc-dl { grid-template-columns: 1fr; gap: 2px; }
    .vc-dl dd { margin-bottom: 10px; }
    .vc-actions .vc-link-btn { flex: 1 1 100%; }
    .vc-invalid { grid-template-columns: 1fr; padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .vc-page *, .vc-page *::before, .vc-page *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
    .vc-skel-doc::after { display: none; }
}
