/* "Continue with WhatsApp" link + QR verification modal (Login page only). */

/* Kept for the modal header icon. */
.wa-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e4dcfd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b5cf6;
    font-size: 22px;
    flex: none;
}

.wa-or {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 10px 0 14px;
}

    .wa-or::before,
    .wa-or::after {
        content: "";
        flex: 1;
        height: 1px;
        background: #e5e7eb;
    }

/* Primary "Continue with WhatsApp" / "Sign up with WhatsApp" button (Login and Create Account pages). */
.wa-signup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 10px 16px;
    background: #8b5cf6;
    color: #fff;
    border: 0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

    .wa-signup-btn .bi-whatsapp { font-size: 20px; }
    .wa-signup-btn:hover { background: #7c3aed; }
    .wa-signup-btn:focus-visible { outline: 2px solid #4c1d95; outline-offset: 2px; }

/* Info banner above the steps: explains why the modal changed (e.g. Forgot PIN -> sign-up). */
.wa-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    color: #4c1d95;
    font-size: 13px;
    line-height: 1.45;
    padding: 12px 14px;
    margin-bottom: 16px;
}

    .wa-notice[hidden] { display: none; }
    .wa-notice > i { color: #8b5cf6; font-size: 20px; line-height: 1.2; flex-shrink: 0; }
    .wa-notice strong { display: block; font-size: 14px; color: #3b0764; margin-bottom: 2px; }

.wa-signup-hint {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
}

/* ---- modal ---- */

#waModal .modal-content {
    border: 0;
    border-radius: 22px;
    padding: 6px 4px 10px;
}

#waModal .modal-header {
    border-bottom: 1px solid #eef0f3;
    padding: 18px 20px 14px;
    align-items: center;
}

.wa-modal-eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #6d28d9;
    text-transform: uppercase;
}

.wa-modal-title {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.wa-qr-panel {
    display: flex;
    gap: 20px;
    align-items: center;
    background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 20px;
}

.wa-qr-box {
    width: 168px;
    height: 168px;
    flex: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

    .wa-qr-box img { width: 100%; height: 100%; image-rendering: pixelated; }

.wa-qr-text h3 { font-size: 17px; font-weight: 600; color: #111827; margin: 6px 0; }
.wa-qr-text p { font-size: 13px; color: #6b7280; margin: 0 0 10px; }

.wa-open-link {
    display: none; /* shown on small screens where scanning your own screen is awkward */
    font-weight: 700;
    font-size: 14px;
    color: #8b5cf6;
    text-decoration: none;
}

.wa-status {
    min-height: 20px;
    font-size: 13px;
    color: #374151;
    text-align: center;
    margin-bottom: 14px;
}

    .wa-status.error { color: #b91c1c; }
    .wa-status.ok { color: #6d28d9; }

.wa-code-label {
    display: block;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: #111827;
    margin-bottom: 8px;
}

.wa-code-input {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    text-align: center;
    letter-spacing: 0.5em;
    font-size: 26px;
    font-weight: 700;
    padding: 12px 8px 12px 20px;
    border: 1.5px solid #8b5cf6;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
}

    .wa-code-input:focus { outline: none; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); }

.wa-code-hint {
    text-align: center;
    font-size: 11.5px;
    color: #6b7280;
    margin: 8px 0 16px;
}

.wa-verify-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    background: #8b5cf6;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 14px;
    cursor: pointer;
}

    .wa-verify-btn:disabled { background: #c4b5fd; cursor: not-allowed; }

.wa-restart {
    display: block;
    margin: 14px auto 6px;
    background: none;
    border: 0;
    color: #6d28d9;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
}

.wa-foot {
    text-align: center;
    font-size: 11.5px;
    color: #6b7280;
}

@media (max-width: 575.98px) {
    .wa-qr-panel { flex-direction: column; text-align: center; gap: 12px; padding: 16px 18px; margin-bottom: 14px; }
    .wa-open-link { display: inline-block; }
    .wa-qr-box { width: 148px; height: 148px; }

    /* Bottom sheet: anchored to the bottom edge, slides up. */
    #waModal .modal-dialog {
        margin: 0;
        min-height: 100%;
        align-items: flex-end;
    }

    #waModal.fade .modal-dialog { transform: translateY(100%); transition: transform 0.25s ease-out; }
    #waModal.show .modal-dialog { transform: none; }

    #waModal .modal-content {
        border-radius: 22px 22px 0 0;
        padding: 4px 2px calc(10px + env(safe-area-inset-bottom));
    }

    #waModal .modal-header { padding: 14px 18px 12px; }
    #waModal .modal-body { padding: 14px 18px 8px; }

    .wa-modal-title { font-size: 19px; }
    .wa-qr-text h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
    .wa-qr-text p { margin-bottom: 8px; }

    .wa-status { margin-bottom: 10px; }
    .wa-code-input { max-width: 240px; font-size: 24px; }
    .wa-code-hint { margin-bottom: 14px; }
}

/* Development mode (Otp:ShowOtpOnScreen): simulate the WhatsApp message, show the OTP */
.wa-dev {
    border: 1.5px dashed #f59e0b;
    background: #fffbeb;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 14px;
}

.wa-dev-title { font-size: 12px; font-weight: 700; color: #b45309; margin-bottom: 8px; }
.wa-dev-row { display: flex; gap: 8px; }

.wa-dev-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
}

.wa-dev-btn {
    border: 0;
    border-radius: 10px;
    background: #f59e0b;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 8px 12px;
    white-space: nowrap;
}

    .wa-dev-btn:disabled { opacity: 0.6; }

.wa-dev-otp {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
}

/* ---- stepper: Scan > Verify > Profile (third step only when it applies) ---- */

#waModal [hidden] { display: none !important; }

.wa-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

    .wa-steps li {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 600;
        color: #9ca3af;
    }

    /* connector between steps */
    .wa-steps li + li::before {
        content: "";
        width: 22px;
        height: 2px;
        margin-right: 6px;
        background: #e5e7eb;
        border-radius: 2px;
    }

.wa-step-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: #f3f4f6;
    color: #6b7280;
}

.wa-steps li.active { color: #4c1d95; }
.wa-steps li.active .wa-step-dot { background: #8b5cf6; color: #fff; }
.wa-steps li.done { color: #6d28d9; }
.wa-steps li.done .wa-step-dot { background: #ede9fe; color: #6d28d9; }
.wa-steps li.done + li::before,
.wa-steps li.active::before { background: #c4b5fd; }

/* ---- sign-up step (new number) ---- */

#waModal .modal-dialog { max-width: 640px; }
#waModal .modal-dialog.wa-dialog-wide { max-width: 760px; }

.wa-modal-subtitle {
    font-size: 13.5px;
    color: #6b7280;
    margin-top: 2px;
}

.wa-verified {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    color: #166534;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    margin-bottom: 18px;
}

    .wa-verified i { color: #16a34a; font-size: 16px; }

.wa-profile-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 20px;
}

.wa-profile-photo { min-width: 0; }

.wa-profile-fields {
    min-width: 0;
    padding-left: 24px;
    border-left: 1px solid #eef0f3;
}

.wa-field-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #111827;
    margin: 0 0 6px;
}

.wa-field-hint {
    font-size: 12px;
    color: #6b7280;
    margin: -2px 0 10px;
}

.wa-profile-fields .wa-field-hint { margin: 6px 0 0; }

/* Photo picker: the 4:5 frame matches the Profile page crop, so the preview shows the saved shape. */
.wa-dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 5;
    padding: 0;
    border: 2px dashed #c4b5fd;
    border-radius: 16px;
    background: #faf8ff;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

    .wa-dropzone:hover { border-color: #8b5cf6; background: #f5f3ff; }
    .wa-dropzone:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 3px; }
    .wa-dropzone.has-photo { border-style: solid; border-color: #8b5cf6; }

    .wa-dropzone img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.wa-dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    text-align: center;
}

.wa-dropzone-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: #ede9fe;
    color: #7c3aed;
    font-size: 34px;
}

.wa-avatar-badge {
    position: absolute;
    right: -4px;
    bottom: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #8b5cf6;
    color: #fff;
    border: 2px solid #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-dropzone-title { font-size: 13.5px; font-weight: 700; color: #6d28d9; }
.wa-dropzone-hint { font-size: 11.5px; color: #6b7280; }

.wa-photo-actions {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 10px;
}

.wa-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    background: none;
    border: 0;
    padding: 0;
    color: #6d28d9;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
}

.wa-text-btn-muted { color: #6b7280; }

/* Inputs with a leading icon (and the PIN's show/hide button at the end). */
.wa-input-icon {
    position: relative;
    margin-bottom: 16px;
}

    .wa-input-icon > i {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #9ca3af;
        font-size: 16px;
        pointer-events: none;
    }

    .wa-input-icon .wa-text-input { margin: 0; padding-left: 42px; }
    .wa-input-icon .wa-pin-input { padding-right: 48px; }

.wa-text-input {
    display: block;
    width: 100%;
    margin: 0 0 14px;
    padding: 11px 14px;
    font-size: 15px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
}

    .wa-text-input:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14); }

.wa-pin-input { letter-spacing: 0.4em; }

.wa-pin-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: #6b7280;
    font-size: 17px;
    cursor: pointer;
}

    .wa-pin-toggle:hover { color: #6d28d9; }
    .wa-pin-toggle:focus-visible { outline: 2px solid #8b5cf6; outline-offset: -2px; }

.wa-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* The shared crop popup opens over the WhatsApp modal: lift it and its backdrop above it. */
#waCropModal { z-index: 1065; }
.modal-backdrop ~ .modal-backdrop { z-index: 1060; }

@media (max-width: 575.98px) {
    .wa-steps { margin-bottom: 12px; }

    .wa-profile-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-bottom: 16px; }
    .wa-profile-photo { text-align: center; }
    .wa-dropzone { width: 168px; margin: 0 auto; }
    .wa-dropzone-avatar { width: 64px; height: 64px; font-size: 28px; margin-bottom: 6px; }
    .wa-profile-fields { padding-left: 0; border-left: 0; }

    /* The bottom sheet can be taller than a phone screen once the profile step is showing. */
    #waModal .modal-content { max-height: 100dvh; overflow-y: auto; }
}

/* "Forgot PIN?" is a button now (opens the WhatsApp modal in reset mode) */
.wa-forgot-btn {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
