/* Roomieus new SPA layer. It intentionally mirrors the old KYC visual system. */
:root {
    --primary: #1a56db;
    --primary-hover: #1e40af;
    --primary-light: #3b82f6;
    --primary-ultra-light: #eff6ff;
    --primary-glow: rgba(26, 86, 219, 0.15);
    --accent-success: #10b981;
    --accent-success-light: #d1fae5;
    --accent-warning: #f59e0b;
    --accent-warning-light: #fef3c7;
    --accent-danger: #ef4444;
    --accent-danger-light: #fee2e2;
    --bg-page: #f0f4f8;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.04), 0 12px 24px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html,
body,
main {
    min-height: 100dvh;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-body);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
    font-family: inherit;
}

.wizard-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
}

.wizard-shell.is-fullscreen {
    padding: 0;
    align-items: stretch;
}

.application-form {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.application-form.is-fullscreen {
    max-width: 100%;
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.roomieus-header {
    padding: 18px 24px 14px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.brand-subtitle {
    font-size: 0.62rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    font-weight: 700;
    text-transform: uppercase;
}

.form-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 15px 20px;
    text-align: center;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.4px;
}

.form-body {
    padding: 24px 20px;
}

.welcome-message {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.welcome-message h1 {
    margin: 0;
    max-width: 340px;
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--text-heading);
}

.wizard-progress-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.wizard-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), #60a5fa);
    transition: width 450ms ease;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.indicator-circle {
    background: linear-gradient(135deg, var(--primary-ultra-light), #dbeafe);
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.section-title {
    color: var(--primary);
    font-size: 1.08rem;
    font-weight: 800;
    margin: 0;
}

.form-input-premium {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-heading);
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
    width: 100%;
}

.form-input-premium:focus,
.form-input-date:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: #fff;
    outline: none;
}

.form-input-premium.is-invalid {
    border-color: var(--accent-danger);
    background: #fef2f2;
}

.form-input-date {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 13px 16px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #f8fafc, #fff);
    color: var(--text-heading);
    width: 100%;
}

.form-label-premium {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.invalid-feedback {
    display: block;
    min-height: 18px;
    font-size: 0.78rem;
    font-weight: 600;
}

.primary-action {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 14px 22px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(26, 86, 219, 0.3);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(26, 86, 219, 0.35);
}

.primary-action:disabled,
.secondary-action:disabled {
    opacity: 0.65;
    transform: none;
    cursor: wait;
}

.secondary-action {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fafc;
    color: var(--text-body);
    padding: 12px 18px;
    font-weight: 800;
}

.success-action {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: #fff;
    padding: 12px 18px;
    font-weight: 800;
}

.warning-action {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-warning), #d97706);
    color: #fff;
    padding: 12px 18px;
    font-weight: 800;
}

.step-copy {
    color: var(--text-secondary);
    line-height: 1.55;
    font-size: 0.94rem;
}

.upload-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sample-frame {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #f8fafc;
    padding: 14px;
    text-align: center;
    margin: 18px 0;
}

.sample-frame img {
    max-width: 100%;
    max-height: 230px;
    object-fit: contain;
    border-radius: 12px;
}

.photo-ready-step {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.photo-ready-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-ultra-light), #dbeafe);
    color: var(--primary);
    font-size: 1.5rem;
}

.photo-ready-title {
    margin: 0 0 4px;
    color: var(--text-heading);
    font-size: 1rem;
    font-weight: 800;
}

.photo-ready-copy {
    margin: 0 0 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.photo-ready-sample {
    display: block;
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    margin: 15px auto 20px;
}

.photo-ready-sample-selfie {
    max-height: 300px;
}

.ready-action {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: #fff;
    padding: 12px 40px;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(5, 150, 105, .24);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 192px;
}

.ready-action-main {
    font-size: 1.05rem;
    line-height: 1.2;
}

.ready-action-sub {
    font-size: 0.85rem;
    opacity: .92;
    line-height: 1.35;
}

.video-instructions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instruction-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-ultra-light), #dbeafe);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 1.2rem;
}

.instruction-title {
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
}

.instruction-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.instruction-block {
    width: 100%;
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instruction-block__inner {
    transition: opacity 0.4s ease;
}

.instruction-block__inner.fade-in {
    opacity: 1;
}

.instruction-block__inner.fade-out {
    opacity: 0;
}

.instruction-block img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
}

.instruction-list {
    padding-left: 20px;
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.instruction-text {
    font-size: 0.85rem;
}

.upload-status {
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-top: 14px;
}

.upload-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 800;
}

.progress-track {
    height: 7px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-top: 9px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 180ms ease;
}

.preview-wrap {
    background: #0f172a;
    border-radius: 18px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    max-height: min(46dvh, 520px);
    min-height: 180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.review-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #111827;
}

.congrats-overlay,
.email-popup-overlay,
.photo-instruction-overlay,
.reload-prompt-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.congrats-card,
.email-popup-card,
.photo-instruction-card,
.reload-prompt-card {
    width: min(400px, 100%);
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 30px 24px;
    text-align: center;
}

.photo-instruction-card {
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
}

.photo-instruction-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.photo-instruction-copy {
    margin: 0 0 30px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.reload-prompt-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    background: var(--accent-warning-light);
    color: var(--accent-warning);
    font-size: 1.6rem;
}

.reload-prompt-card h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}

.reload-prompt-card p {
    margin: 0 0 22px;
    color: var(--text-muted);
}

.reload-prompt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.status-dot.uploading {
    background: var(--accent-warning);
    animation: pulse 1s infinite;
}

.status-dot.uploaded {
    background: var(--accent-success);
}

.status-dot.error {
    background: var(--accent-danger);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.35);
        opacity: 0.75;
    }
}

.page-video {
    height: 100% !important;
    position: relative;
    background: #020617;
    color: #fff;
    flex: 1;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.liveness-video-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
}

#webcam {
    z-index: 1 !important;
    flex-grow: initial !important;
    max-height: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    width: 100% !important;
    object-fit: contain !important;
    background: #020617;
}

@media (max-width: 991px) {
    .page-video #webcam {
        transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
    }
}

.liveness-close-btn {
    z-index: 999;
    color: #fff;
}

.liveness-timer-row,
.liveness-not-recognized {
    z-index: 999;
    color: #fff;
    padding-top: 1.5rem;
    margin: 0;
    text-align: center;
    min-height: 64px;
}

.liveness-icon-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: #fff;
    padding: 0;
    margin-left: 6px;
    line-height: 1;
    cursor: pointer;
}

.video-position__text {
    position: absolute;
    bottom: 10px;
    width: 100%;
    left: 0;
    padding: 0 15px;
    z-index: 99;
    text-align: center;
    pointer-events: none;
}

.video-position__text h5 {
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hold-timer-top {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    font-size: 2rem;
    font-weight: 900;
    color: #4ade80;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 6px 28px;
    border-radius: 30px;
    border: 2px solid rgba(74, 222, 128, 0.4);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
    animation: holdPulse 1s ease-in-out infinite;
    pointer-events: none;
}

@keyframes holdPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scale(1.08);
        opacity: 0.85;
    }
}

#webcam-wrapper {
    position: absolute;
    width: 200px;
    height: 250px;
    max-width: 90%;
    max-height: 90%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 100vmax rgba(50, 50, 50, 0.95);
    border-radius: 50%;
    z-index: 9;
}

.webcam-wrapper__inner {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.webcam-wrapper__top,
.webcam-wrapper__bottom,
.webcam-wrapper__left,
.webcam-wrapper__right {
    position: absolute;
    border: 8px solid #b4b5b3;
    background: transparent;
    transition: background-color .3s ease, box-shadow .3s ease;
}

.webcam-wrapper__top,
.webcam-wrapper__bottom {
    left: -10px;
    width: calc(100% + 20px);
    height: 260px;
    border-radius: 45%;
    border-left-color: transparent;
    border-right-color: transparent;
}

.webcam-wrapper__top {
    top: -20px;
    border-bottom-color: transparent;
}

.webcam-wrapper__bottom {
    bottom: -20px;
    border-top-color: transparent;
}

.webcam-wrapper__left,
.webcam-wrapper__right {
    top: 0;
    width: 210px;
    height: 100%;
    border-radius: 39%;
    border-bottom-color: transparent;
    border-top-color: transparent;
}

.webcam-wrapper__left {
    left: -15px;
    border-right-color: transparent;
}

.webcam-wrapper__right {
    right: -15px;
    border-left-color: transparent;
}

.success--left {
    border-left-color: green !important;
}

.success--right {
    border-right-color: green !important;
}

.success--top {
    border-top-color: green !important;
}

.success--bottom {
    border-bottom-color: green !important;
}

.error--left {
    border-left-color: red !important;
}

.error--right {
    border-right-color: red !important;
}

.error--top {
    border-top-color: red !important;
}

.error--bottom {
    border-bottom-color: red !important;
}

.flash--left {
    border-left-color: orange !important;
    animation: flashBlink .6s ease-in-out;
}

.flash--right {
    border-right-color: orange !important;
    animation: flashBlink .6s ease-in-out;
}

.flash--top {
    border-top-color: orange !important;
    animation: flashBlink .6s ease-in-out;
}

.flash--bottom {
    border-bottom-color: orange !important;
    animation: flashBlink .6s ease-in-out;
}

@keyframes flashBlink {
    0% {
        opacity: .4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .4;
    }
}

.liveness-upload-sink {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.complete-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-success-light);
    color: var(--accent-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.3rem;
    margin: 0 auto 20px;
}

.toast-stack {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 20000;
    display: grid;
    gap: 10px;
}

.app-toast {
    width: min(340px, calc(100vw - 32px));
    border-radius: 14px;
    background: #fff;
    color: var(--text-heading);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary);
    padding: 13px 14px;
    font-size: 0.9rem;
    font-weight: 700;
}

.app-toast.success {
    border-left-color: var(--accent-success);
}

.app-toast.error {
    border-left-color: var(--accent-danger);
}

.app-toast.warning {
    border-left-color: var(--accent-warning);
}

@media (max-width: 575.98px) {
    .wizard-shell {
        padding: 10px;
        align-items: flex-start;
    }

    .application-form {
        border-radius: var(--radius-lg);
    }

    .form-body {
        padding: 18px 16px;
    }

    .upload-actions {
        grid-template-columns: 1fr;
    }

    .primary-action,
    .secondary-action,
    .success-action,
    .warning-action {
        width: 100%;
    }

    .welcome-message {
        min-height: 260px;
    }

    #webcam {
        min-height: 0;
    }
}
