/*
Theme Name: Verifi.me KYC
Theme URI: https://verifi.my
Description: Enterprise KYC Identity Verification Theme
Version: 2.0.0
Author: Verifi.me
Author URI: https://verifi.my
Text Domain: verifi
Requires at least: 5.9
Requires PHP: 7.4
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    --brand:       #4338ca;
    --brand-dark:  #3730a3;
    --brand-light: #eef2ff;
    --accent:      #6366f1;
    --success:     #10b981;
    --success-bg:  #ecfdf5;
    --error:       #ef4444;
    --error-bg:    #fef2f2;

    --bg-app:    #f0f2f5;
    --bg-card:   #ffffff;
    --bg-subtle: #f8fafc;
    --bg-input:  #ffffff;

    --border:       #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #6366f1;

    --text:      #0f172a;
    --text-muted:#64748b;
    --text-light:#94a3b8;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(15,23,42,.06);
    --shadow-md: 0 4px 24px rgba(15,23,42,.07);
    --shadow-lg: 0 20px 40px rgba(15,23,42,.1);
    --shadow-focus: 0 0 0 3px rgba(99,102,241,.2);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --ease: cubic-bezier(.16,1,.3,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ============================================================
   RESET
   ============================================================ */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; -webkit-font-smoothing:antialiased; }
body {
    font-family: var(--font);
    background: var(--bg-app);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
a { color: var(--brand); text-decoration: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.vf-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.vf-modal {
    width: 100%;
    max-width: 660px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modal header */
.vf-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    flex-shrink: 0;
}
.vf-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: .9375rem;
    color: var(--text);
}
.vf-brand__icon {
    width: 28px; height: 28px;
    background: var(--brand);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.vf-ssl-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .6875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 4px 9px;
    border-radius: var(--radius-full);
}
.vf-ssl-badge__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
}

/* Modal body */
.vf-modal__body {
    padding: 24px 24px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Modal footer */
.vf-modal__foot {
    padding: 12px 22px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .6875rem;
    color: var(--text-light);
    flex-shrink: 0;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.vf-progress {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}
.vf-progress__step {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}
.vf-progress__step:last-child { flex: 0; }

.vf-progress__circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-light);
    font-size: .75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all .25s var(--ease-spring);
    z-index: 1;
}
.vf-progress__line {
    flex: 1;
    height: 2px;
    background: var(--border);
    transition: background .3s var(--ease);
}
.vf-progress__label {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-light);
    white-space: nowrap;
}

/* States */
.vf-progress__step--active .vf-progress__circle {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.vf-progress__step--active .vf-progress__label { color: var(--brand); }
.vf-progress__step--done .vf-progress__circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.vf-progress__step--done .vf-progress__line { background: var(--success); }
.vf-progress__step--done .vf-progress__label { color: var(--success); }

/* ============================================================
   STEP CONTENT
   ============================================================ */
.vf-step { display: none; }
.vf-step--active {
    display: block;
    animation: stepIn .28s var(--ease) both;
}
@keyframes stepIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vf-step__heading { margin-bottom: 18px; }
.vf-step__heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.vf-step__heading p {
    font-size: .875rem;
    color: var(--text-muted);
}

/* Step nav (back / continue) */
.vf-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    padding: 0 22px;
    border-radius: var(--radius-md);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all .2s var(--ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    text-decoration: none;
}
.btn--primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67,56,202,.25);
}
.btn--primary:hover  { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(67,56,202,.35); }
.btn--primary:active { transform: scale(.97); }
.btn--secondary {
    background: var(--bg-subtle);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn--secondary:hover { background: #eef0f3; }
.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0 12px;
}
.btn--ghost:hover { color: var(--text); background: var(--bg-subtle); }
.btn--full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn--loading { pointer-events: none; }
.btn--loading .btn__label { visibility: hidden; }
.btn--loading::after {
    content:'';
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.form-input,
.form-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 1rem; /* 16px — prevents iOS zoom */
    color: var(--text);
    -webkit-appearance: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.form-input--err { border-color: var(--error) !important; background: var(--error-bg) !important; }

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

.form-divider {
    height: 1px;
    background: var(--border-light);
    margin: 18px 0;
}
.form-section-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-light);
    margin-bottom: 12px;
}
.form-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}
.form-checkbox-row input[type=checkbox] {
    width: 17px; height: 17px;
    margin-top: 2px;
    accent-color: var(--brand);
    cursor: pointer;
    flex-shrink: 0;
}
.form-checkbox-row span {
    font-size: .8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================================
   DOCUMENT TYPE CARDS
   ============================================================ */
.doc-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.doc-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--bg-card);
    transition: all .18s var(--ease);
    -webkit-tap-highlight-color: transparent;
    min-height: 54px;
}
.doc-card:active { transform: scale(.97); }
.doc-card--selected {
    border-color: var(--accent);
    background: var(--brand-light);
}
.doc-card__icon { font-size: 1.25rem; flex-shrink: 0; }
.doc-card__title { font-size: .8125rem; font-weight: 600; color: var(--text); }
.doc-card__sub   { font-size: .7rem; color: var(--text-light); }

/* ============================================================
   GUIDELINES STRIP
   ============================================================ */
.guidelines {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    justify-content: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    margin-bottom: 16px;
}
.guideline {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.guideline svg { color: var(--success); }

/* ============================================================
   CAMERA
   ============================================================ */
.camera-wrap {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
}

.camera-placeholder {
    background: var(--bg-subtle);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 36px 20px;
}
.camera-placeholder__icon { color: var(--brand); margin-bottom: 10px; }

.camera-live { display: none; }

.camera-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 52vh;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #000;
}
.camera-viewport video {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.camera-viewport svg.oval-svg {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
}
.oval-path { animation: ovalPulse 3s ease-in-out infinite; }
@keyframes ovalPulse {
    0%,100% { stroke: #6366f1; }
    50%      { stroke: #10b981; }
}
.camera-guide-pill {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    z-index: 4;
    white-space: nowrap;
}
.camera-live-badge {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    z-index: 4;
}
.camera-live-badge__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #10b981;
    animation: livePulse 1.5s ease-in-out infinite;
}
@keyframes livePulse {
    0%,100% { opacity: 1; }
    50%      { opacity: .4; }
}

.camera-controls {
    display: flex;
    justify-content: center;
    padding: 14px;
    background: var(--bg-card);
}

.selfie-preview { display: none; text-align: center; padding: 16px; }
.selfie-thumb {
    width: 150px; height: 195px;
    border-radius: 50%;
    border: 3px solid var(--brand);
    overflow: hidden;
    margin: 0 auto 14px;
    box-shadow: var(--shadow-md);
}
.selfie-thumb img { width: 100%; height: 100%; object-fit: cover; }
.selfie-actions { display: flex; justify-content: center; gap: 10px; }

/* ============================================================
   DROPZONES
   ============================================================ */
.dropzone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }

.dropzone {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all .18s var(--ease);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.dropzone:hover, .dropzone--over { border-color: var(--brand); background: var(--brand-light); }
.dropzone__body { padding: 14px 10px; pointer-events: none; }
.dropzone__icon { color: var(--brand); margin-bottom: 6px; }
.dropzone__title { font-size: .8125rem; font-weight: 600; color: var(--text); }
.dropzone__hint  { font-size: .7rem; color: var(--text-light); margin-top: 2px; }

.dropzone__preview { display: none; width: 100%; padding: 8px; position: relative; }
.dropzone__preview img { width: 100%; height: 130px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.dropzone__clear {
    position: absolute;
    top: 12px; right: 12px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--error);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   REVIEW
   ============================================================ */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.review-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 13px;
}
.review-card--full { grid-column: 1 / -1; }
.review-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.review-card__head h3 {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}
.review-selfie-thumb {
    width: 80px; height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid var(--brand);
}
.review-selfie-thumb img { width: 100%; height: 100%; object-fit: cover; }
.review-id-imgs { display: flex; gap: 6px; }
.review-id-imgs img { flex: 1; height: 80px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.review-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.review-detail__label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); }
.review-detail__value { font-size: .8125rem; font-weight: 500; color: var(--text); }
.review-detail--full { grid-column: 1/-1; }

/* ============================================================
   SUCCESS
   ============================================================ */
.success-icon {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
}
.success-ref {
    display: inline-block;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 20px;
    margin-top: 14px;
}
.success-ref__label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-light); margin-bottom: 3px; }
.success-ref__code  { font-family: var(--font-mono); font-size: 1.125rem; font-weight: 700; color: var(--brand); }

/* ============================================================
   OVERLAY & TOAST
   ============================================================ */
.vf-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease);
}
.vf-overlay--show { opacity: 1; pointer-events: auto; }
.vf-overlay__spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.vf-overlay__text { font-size: .9375rem; font-weight: 600; color: var(--text); }

.vf-toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(60px);
    z-index: 10000;
    background: var(--error);
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    padding: 11px 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: all .3s var(--ease);
    max-width: 90vw;
    text-align: center;
    pointer-events: none;
}
.vf-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* ============================================================
   MOBILE BREAKPOINT
   ============================================================ */
@media (max-width: 600px) {
    body { background: #fff; }
    .vf-page { padding: 0; align-items: flex-start; }
    .vf-modal {
        border-radius: 0; border: none;
        box-shadow: none; min-height: 100vh;
    }
    .vf-modal__body { padding: 16px 14px 24px; }
    .vf-modal__head { padding: 12px 14px; }
    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .doc-type-grid { grid-template-columns: 1fr; }
    .dropzone-grid { grid-template-columns: 1fr; }
    .review-grid { grid-template-columns: 1fr; }
    .review-details-grid { grid-template-columns: 1fr; }
    .vf-nav { flex-direction: column-reverse; }
    .vf-nav .btn { width: 100%; }
    .selfie-actions { flex-direction: column; }
    .selfie-actions .btn { width: 100%; }
    .vf-progress__label { display: none; }
}
