/*
 * VOYAH registration theme
 * Flow: welcome -> information -> face capture -> confirm -> success (+ closed / coming soon pages)
 * Trasandina (VOYAH brand font, /fonts) for all text; it has no Thai letters, so Thai falls back to Adelle Sans Thai.
 */
/* weights by style name (the files' own weight numbers are one step higher: Regular 500, Medium 600) */
@font-face { font-family: 'Trasandina'; src: url('/fonts/TrasandinaLight.otf') format('opentype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Trasandina'; src: url('/fonts/TrasandinaRegular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Trasandina'; src: url('/fonts/TrasandinaMedium.otf') format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Trasandina'; src: url('/fonts/TrasandinaBold.otf') format('opentype'); font-weight: 700; font-display: swap; }

@font-face { font-family: 'AdelleSansTHA'; src: url('/assets/font/AdelleSansTHA-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'AdelleSansTHA'; src: url('/assets/font/AdelleSansTHA-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }

:root {
    --v-navy: #0f1d4a;
    --v-navy-80: #2a3866;
    --v-text: #1b1c3a;
    --v-muted: #5b6480;
    --v-line: #d6deef;
    --v-field: #f5f8fd;
    --v-font: 'Trasandina', 'AdelleSansTHA', Tahoma, sans-serif;
}

/* ---------- base ---------- */
body {
    margin: 0;
    font-family: var(--v-font);
    font-weight: 400;
    color: var(--v-text);
	background: #eaf3ff linear-gradient(160deg, #eaf3ff 0%, #cfe3fb 45%, #f4f8ff 100%) no-repeat;
    min-height: 100vh;
}
h1, h2, h3, h4, h5, h6, label, p, small, input, select, textarea, .btn, .form-control {
    font-family: var(--v-font);
}


#ticket {
    padding: 24px 16px 28px;
    margin-top: -24px;
}


/* ---------- page layout: one centred column on the background ---------- */
.v-page {
    display: flex;
    justify-content: center;
    padding: 0 16px;
}
.v-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    min-height: 100vh;
    padding: 28px 0;
    display: flex;
    flex-direction: column;
}

.v-step { display: none; flex: 1; flex-direction: column; }
.v-step.active { display: flex; }

.v-head {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
}
.v-logo { width: 140px; height: auto; }
.v-back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px 12px 8px;
    color: var(--v-navy);
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
}

.v-title {
    text-align: center;
    color: var(--v-navy);
    font-weight: 700;
    font-size: 22px;
    line-height: 1.25;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.v-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0;
}
.v-text { text-align: center; color: var(--v-text); }

.v-body { flex: 1; }
.v-actions { margin-top: 24px; display: flex; gap: 10px; }
.v-alert { border-radius: 12px; font-size: 14px; }

/* closed / coming soon message */
.v-msg {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    color: var(--v-navy);
}
.v-msg h1 { font-size: 20px; font-weight: 500; line-height: 1.5; margin-bottom: 16px; }

/* ---------- buttons ---------- */
.v-btn,
.v-btn:hover,
.v-btn:focus {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--v-navy);
    border: 1px solid var(--v-navy);
    color: #fff !important;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 17px;
    text-transform: uppercase;
    box-shadow: none;
}
.v-btn:hover { background: var(--v-navy-80); }
/* grey until it can be used (e.g. Next before a photo is taken) */
.v-btn:disabled,
.v-btn:disabled:hover {
    background: #b9c0cf;
    border-color: #b9c0cf;
    opacity: 1;
    cursor: not-allowed;
}
.v-btn-outline,
.v-btn-outline:hover,
.v-btn-outline:focus {
    background: #fff;
    color: var(--v-navy) !important;
}
.v-link-btn {
    display: block;
    margin: 0 auto;
    background: none;
    border: 0;
    color: var(--v-navy);
    text-decoration: underline;
    font-weight: 500;
}

/* ---------- 1. welcome: Privacy Policy popup ---------- */
.v-policy {
    font-size: 14px;
    line-height: 1.65;
    color: var(--v-text);
    overflow-wrap: anywhere; /* long e-mail addresses on narrow phones */
}
.v-policy p { margin-bottom: 10px; }
.v-policy b { font-weight: 600; }
.v-policy-note { color: var(--v-muted); }
.v-policy-consents {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--v-line);
}
.v-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 400;
    color: var(--v-text);
    cursor: pointer;
}
.v-consent-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--v-navy); flex: none; cursor: pointer; }
.v-consent-tag {
    display: inline-block;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--v-field);
    border: 1px solid var(--v-line);
    color: var(--v-muted);
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
}
.v-consent-tag-req { color: #b42318; border-color: #f3c2bd; background: #fef3f2; }

/* ---------- 2. information: inputs ---------- */
.v-field { margin-bottom: 12px; }
.v-field .form-control {
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--v-line);
    background: var(--v-field);
    color: var(--v-text);
    padding: 10px 14px;
}
.v-field .form-control::placeholder { color: var(--v-text); opacity: 0.8; }
.v-field .form-control:focus {
    border-color: var(--v-navy-80);
    box-shadow: 0 0 0 0.2rem rgba(15, 29, 74, 0.12);
    background: #fff;
}

/* ---------- 3. face capture ---------- */
.v-camera {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1 / 1;
    margin: 8px auto 16px;
    border-radius: 18px;
    overflow: hidden;
    background: #dfe6f2;
}
.v-camera video,
.v-camera img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.v-camera video { transform: scaleX(-1); } /* selfie preview, like a mirror */
.v-corner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 4px solid #fff;
    pointer-events: none;
}
.v-corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.v-corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.v-corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.v-corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.v-camera-msg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    z-index: 1; /* above the face guide mask */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* oval face guide - camera frame and crop popup */
.face-guide {
    position: absolute;
    inset: 0;
    pointer-events: none; /* drags pass through to the photo */
}
.face-guide svg {
    width: 100%;
    height: 100%;
    display: block;
}
.face-guide-mask {
    fill: rgba(0, 0, 0, 0.35);
}
.face-guide-line {
    fill: none;
    stroke: #fff;
    stroke-width: 1;
    stroke-dasharray: 3 2;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.6));
}

/* face check while the camera is live: green = face in the oval, red = not yet */
.v-camera.face-ok .face-guide-line,
.v-camera.face-bad .face-guide-line {
    stroke-width: 3;
    stroke-dasharray: none;
    transition: stroke 0.2s;
}
.v-camera.face-ok .face-guide-line { stroke: #22c55e; }
.v-camera.face-bad .face-guide-line { stroke: #ef4444; }
.v-camera.face-ok .v-corner { border-color: #22c55e; }
.v-camera.face-bad .v-corner { border-color: #ef4444; }
#captureHint { min-height: 1.5em; }
#faceDebug:empty { display: none; }

/* crop popup (upload photo) */
.modal-content { border-radius: 16px; }
.modal-title { color: var(--v-navy); font-weight: 500; }
.crop-instruction {
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    color: var(--v-navy);
    margin-bottom: 8px;
}
/* square area; exact size is set in JS when the popup opens */
.crop-area {
    margin: 0 auto;
    max-width: 100%;
    overflow: hidden;
}
#sampleImage {
    display: block;
    max-width: 100%; /* required by cropper.js */
}
.crop-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
.crop-controls .btn-image { min-width: 42px; }

.btn-image,
.btn-image:hover,
.btn-image:focus {
    background-color: var(--v-navy);
    border: 1px solid var(--v-navy);
    color: #fff !important;
    border-radius: 50px;
    box-shadow: none;
}
.btn-image:hover { background-color: var(--v-navy-80); }
.btn-secondary,
.btn-secondary:focus {
    border-radius: 50px;
    background-color: #fff;
    border-color: var(--v-line);
    color: var(--v-navy) !important;
    box-shadow: none;
}
.btn-secondary:hover {
    background-color: var(--v-field);
    border-color: var(--v-line);
}

/* cropper: frame + guide fixed, only the photo moves (id-scoped to win over cropper.min.css) */
#editImage .cropper-view-box {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 0;
}
#editImage .cropper-line,
#editImage .cropper-point {
    display: none;
}
#editImage .cropper-face,
#editImage .cropper-drag-box {
    cursor: move;
}
#editImage .cropper-container {
    touch-action: none; /* one-finger drag moves the photo instead of scrolling */
}

/* ---------- 4. confirm ---------- */
.v-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--v-field);
    border: 1px solid var(--v-line);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 14px;
}
.v-row-label { flex: 0 0 38%; color: var(--v-muted); }
.v-row-value { flex: 1; font-weight: 500; word-break: break-word; }

/* ---------- 5. success ---------- */
.v-check {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--v-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.v-qr {
    display: flex;
    justify-content: center;
    margin: 20px auto;
}
.v-qr img {
    width: 200px;
    height: 200px;
    background: #fff;
    image-rendering: pixelated; /* keep the QR edges sharp when scaled */
}
.v-qr-code {
    margin-top: -12px;
    font-weight: 500;
    letter-spacing: 3px;
    color: var(--v-navy);
}
.v-event { text-align: center; }
.v-event h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--v-navy);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.v-event p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 500;
}
.v-event svg { color: var(--v-navy); flex: none; }

@media (max-width: 600px) {
    .crop-instruction { font-size: 13px; line-height: 1.5; }
    .modal-title { font-size: 20px; }
}
