/* PRS Registry - Jumbo Domain Styles (White + Purple #6a1b9a Identity) */

:root {
    --jb-bg: #ffffff;
    --jb-surface: #faf7fc;
    --jb-border: #e9dff0;
    --jb-border-focus: #6a1b9a;
    --jb-text-main: #1f1629;
    --jb-text-muted: #645873;
    --jb-primary: #6a1b9a;
    --jb-primary-hover: #521378;
    --jb-primary-soft: #f4ebf9;
    --jb-primary-border: #d8bde8;
    --jb-primary-ring: rgba(106, 27, 154, 0.14);
    --jb-primary-shadow: rgba(106, 27, 154, 0.24);
    --jb-primary-text: #ffffff;
    --jb-frame-dark: #1f1629;
    --jb-guide-border: rgba(255, 255, 255, 0.78);
    --jb-overlay-bg: rgba(255, 255, 255, 0.85);
    --jb-hud-bg: rgba(17, 24, 39, 0.78);
    --jb-status-holding: rgba(180, 83, 9, 0.9);
    --jb-status-capturing: rgba(21, 128, 61, 0.92);
    --jb-bar-track: rgba(255, 255, 255, 0.3);
    --jb-text-shadow-dark: rgba(0, 0, 0, 0.6);
}

.privacy-content {
    font-size: 0.95rem;
    color: var(--jb-text-main);
    line-height: 1.65;
    margin-bottom: 1.75rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.privacy-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.25rem 0 0.45rem;
}

.privacy-content h3:first-child {
    margin-top: 0;
}

.privacy-content ul {
    padding-left: 1.25rem;
    margin-bottom: 0.85rem;
}

.consent-check-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.15rem 1.25rem;
    border: 2px solid var(--jb-border);
    border-radius: 16px;
    background: var(--jb-bg);
    cursor: pointer;
    font-size: 0.82rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.consent-check-card:has(input:checked) {
    border-color: var(--jb-primary);
    background: var(--jb-primary-soft);
}

.consent-check-card input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    accent-color: var(--jb-primary);
    flex-shrink: 0;
}

.consent-check-card input[type="checkbox"].is-invalid {
    outline: 2px solid var(--jb-danger);
    outline-offset: 2px;
}

.capture-single {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.capture-single > .btn-primary {
    font-size: 0.92rem;
    padding: 12px 16px;
}

.id1-frame,
.selfie-frame {
    position: relative;
    border-radius: 14px;
    border: 2px dashed var(--jb-border);
    background: var(--jb-surface);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.id1-frame {
    aspect-ratio: 85.6 / 53.98;
}

.id1-frame.has-image,
.id1-frame.is-streaming,
.selfie-frame.is-streaming,
.selfie-frame.has-video {
    border-style: solid;
    border-color: var(--jb-primary);
    background: var(--jb-frame-dark);
}

.id1-frame img,
.id1-frame video {
    width: 100%;
    height: 100%;
    display: block;
}

.id1-frame img {
    object-fit: contain;
}

.id1-frame video {
    object-fit: cover;
}

/* Scanner overlay: same box and object-fit as the video, so the guide and detected outline align pixel-perfectly. */
.id1-frame .id1-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Front/laptop cameras are mirrored for natural hand movement; the captured crop itself is never flipped. */
.id1-frame.is-mirrored video,
.id1-frame.is-mirrored .id1-overlay {
    transform: scaleX(-1);
}

.capture-placeholder {
    padding: 1rem;
    color: var(--jb-text-muted);
    font-size: 0.9rem;
}

.capture-placeholder i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--jb-primary);
}

.camera-status,
.selfie-phrase,
.selfie-rec {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--jb-hud-bg);
    color: var(--jb-primary-text);
    font-weight: 700;
    pointer-events: none;
}

.camera-status {
    bottom: 0.7rem;
    max-width: calc(100% - 1.25rem);
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    line-height: 1.3;
    text-align: center;
    transition: background-color 0.2s ease;
}

.camera-status[data-state="holding"] {
    background: var(--jb-status-holding);
}

.camera-status[data-state="capturing"] {
    background: var(--jb-status-capturing);
}

/* ---- Verification video (selfie holding the credential) ---- */
.capture-single[data-side="video"] {
    max-width: 380px;
}

.selfie-frame {
    /* Portrait frame capped by viewport height so the record button stays visible on phones. */
    width: min(100%, calc(56vh * 3 / 4));
    margin: 0 auto;
    aspect-ratio: 3 / 4;
}

.selfie-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Front camera preview is mirrored like a mirror; the recorded file is never flipped. */
.selfie-frame .selfie-live {
    transform: scaleX(-1);
}

.selfie-frame .selfie-review {
    object-fit: contain;
    background: var(--jb-frame-dark);
}

.selfie-guide {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.selfie-guide-face {
    position: absolute;
    left: 14%;
    top: 16%;
    width: 46%;
    height: 50%;
    border: 2px dashed var(--jb-guide-border);
    border-radius: 50%;
}

.selfie-guide-card {
    position: absolute;
    right: 6%;
    top: 30%;
    width: 30%;
    aspect-ratio: 85.6 / 53.98;
    border: 2px dashed var(--jb-guide-border);
    border-radius: 6px;
    transform: rotate(-8deg);
}

.selfie-phrase {
    top: 0.75rem;
    padding: 0.35rem 0.9rem;
    font-weight: 800;
    font-size: 0.95rem;
    white-space: nowrap;
}

.selfie-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: 800;
    color: var(--jb-primary-text);
    text-shadow: 0 2px 16px var(--jb-text-shadow-dark);
    pointer-events: none;
}

.selfie-rec {
    bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

.selfie-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--jb-danger);
    animation: selfie-rec-blink 1s infinite;
}

.selfie-rec-bar {
    width: 90px;
    height: 5px;
    border-radius: 999px;
    background: var(--jb-bar-track);
    overflow: hidden;
}

.selfie-rec-bar > span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--jb-danger);
}

@keyframes selfie-rec-blink {
    50% {
        opacity: 0.25;
    }
}

.form-section-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 1.75rem 0 1rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--jb-border);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.form-section-title i {
    color: var(--jb-primary);
}

.fields-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0 1.25rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--jb-primary);
    box-shadow: 0 0 0 4px var(--jb-primary-ring);
}

.btn-primary {
    box-shadow: 0 4px 14px var(--jb-primary-shadow);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px var(--jb-primary-shadow);
}

.btn-outline:hover {
    border-color: var(--jb-primary);
    color: var(--jb-primary);
    background: var(--jb-primary-soft);
}

body > footer nav button:first-child:hover {
    background: var(--jb-primary-soft);
    color: var(--jb-primary);
}

.field.is-compact input,
.field.is-compact select,
.field.is-compact textarea {
    padding: 17px 18px 14px;
    font-size: 1rem;
}

.field.is-compact label {
    top: 16px;
    font-size: 0.98rem;
}

.field.is-compact input:focus + label,
.field.is-compact textarea:focus + label,
.field.is-compact input:not(:placeholder-shown) + label,
.field.is-compact textarea:not(:placeholder-shown) + label,
.field.is-compact select + label {
    top: -10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--jb-primary);
}

.folio-hero {
    background: var(--jb-primary-soft);
    border: 2px solid var(--jb-primary);
    border-radius: 22px;
    padding: 2rem 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.folio-brand-logo {
    height: 56px;
    width: auto;
    display: block;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.folio-label {
    font-weight: 700;
    color: var(--jb-text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.folio-number {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--jb-primary);
    margin: 0.5rem 0;
}

.folio-datetime {
    color: var(--jb-text-muted);
    font-size: 0.95rem;
}

.folio-actions {
    text-align: center;
}

.review-card {
    overflow-wrap: anywhere;
}

.review-item {
    gap: 1rem;
}

.review-value {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.is-ui-locked {
    overflow: hidden;
    touch-action: none;
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: var(--jb-overlay-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.processing-card {
    max-width: 380px;
    width: 100%;
    background: var(--jb-bg);
    border: 1.5px solid var(--jb-primary-border);
    border-radius: 22px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 45px var(--jb-primary-shadow);
}

.processing-card h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--jb-text-main);
    margin: 1rem 0 0.4rem;
}

.processing-card p {
    font-size: 0.92rem;
    color: var(--jb-text-muted);
    line-height: 1.5;
}

.processing-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px solid var(--jb-primary-soft);
    border-top-color: var(--jb-primary);
    animation: prsSpin 0.85s linear infinite;
}

@keyframes prsSpin {
    to {
        transform: rotate(360deg);
    }
}

.d-none,
.btn-outline.d-none,
.btn-primary.d-none,
.id1-frame .d-none,
.selfie-frame .d-none,
.processing-overlay.d-none {
    display: none;
}

@media (max-width: 600px) {
    .review-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .review-value {
        text-align: left;
        width: 100%;
    }
}
