/* ==========================================================================
   OTP MODAL
   ========================================================================== */


/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.otp-modal-dialog {
    max-width: 440px;
}

.otp-modal {
    position: relative;

    overflow: hidden;

    border: 1px solid var(--app-border);
    border-radius: 18px;

    background: var(--app-surface);

    box-shadow: var(--app-shadow-lg);
}


/* --------------------------------------------------------------------------
   Close Button
   -------------------------------------------------------------------------- */

.otp-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 5;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;

    border: none;
    border-radius: 50%;

    background: transparent;

    color: var(--app-heading);

    cursor: pointer;

    transition: background-color 0.15s ease-in-out;
}

.otp-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.otp-close-btn:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

.otp-close-btn i,
.otp-close-btn svg {
    width: 22px;
    height: 22px;
}


/* --------------------------------------------------------------------------
   Top Banner Graphic (full width)
   -------------------------------------------------------------------------- */

.otp-banner {
    line-height: 0;

    background: #e6f7ee;
}

.otp-graphic {
    display: block;

    width: 100%;
    height: auto;
}


/* --------------------------------------------------------------------------
   Modal Body
   -------------------------------------------------------------------------- */

.otp-modal .modal-body {
    padding: 22px 32px 28px;
}


/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.otp-header {
    margin-bottom: 22px;
}

.otp-title {
    margin: 0 0 10px;

    color: var(--app-heading);

    font-size: 1.6rem;
    font-weight: 700;

    line-height: 1.25;
}

.otp-subtext {
    margin-bottom: 4px;

    font-size: 14.5px;

    color: var(--app-text-muted);

    line-height: 1.45;
}


/* --------------------------------------------------------------------------
   Mobile Number + Edit
   -------------------------------------------------------------------------- */

.otp-mobile-row {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;
}

.otp-mobile {
    font-size: 16.5px;

    color: var(--app-heading);

    font-weight: 700;

    letter-spacing: 0.2px;
}

.otp-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 2px;

    border: none;

    background: transparent;

    color: var(--app-primary);

    cursor: pointer;
}

.otp-edit-btn:hover {
    color: var(--app-primary-hover);
}

.otp-edit-btn:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;

    border-radius: 4px;
}

.otp-edit-btn i,
.otp-edit-btn svg {
    width: 15px;
    height: 15px;
}


/* --------------------------------------------------------------------------
   OTP Inputs (same boxes as the old design)
   -------------------------------------------------------------------------- */

.otp-inputs {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 10px;

    margin-top: 4px;
    margin-bottom: 20px;
}

.otp-input {
    width: 46px;
    height: 52px;

    padding: 0;

    text-align: center;

    color: var(--app-text);

    background-color: var(--app-surface-secondary);

    border: 1px solid var(--app-border);

    border-radius: 10px;

    font-size: 20px;
    font-weight: 700;

    line-height: 52px;

    transition:
        border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out,
        background-color 0.15s ease-in-out;
}

/* Dot placeholder for empty boxes */

.otp-input::placeholder {
    color: var(--app-text-light);

    font-size: 14px;
    font-weight: 400;

    opacity: 0.7;
}

.otp-input:focus::placeholder {
    color: transparent;
}

.otp-input:hover {
    border-color: var(--app-border-dark);
}

.otp-input:focus {
    outline: none;

    background-color: var(--app-surface);

    border-color: var(--app-primary);

    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
}


/* --------------------------------------------------------------------------
   Expiry Timer
   -------------------------------------------------------------------------- */

.otp-timer-row {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    margin-bottom: 22px;

    color: var(--app-text-muted);

    font-size: 14px;
}

.otp-timer-row i,
.otp-timer-row svg {
    width: 16px;
    height: 16px;
}

.otp-timer-label {
    color: var(--app-text-muted);
}

.otp-timer {
    color: var(--app-primary);

    font-weight: 700;

    font-variant-numeric: tabular-nums;
}


/* --------------------------------------------------------------------------
   Verify Button
   -------------------------------------------------------------------------- */

.otp-verify-btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    width: 100%;

    padding: 13px 18px;

    color: #ffffff;

    font-size: 15.5px;
    font-weight: 600;

    border: none;

    border-radius: 10px;

    background: var(--app-primary);

    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.18);

    cursor: pointer;

    transition:
        background-color 0.15s ease-in-out,
        transform 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
}

.otp-verify-btn i,
.otp-verify-btn svg {
    width: 18px;
    height: 18px;
}

.otp-verify-btn:hover:not(:disabled) {
    color: #ffffff;

    background: var(--app-primary-hover);

    transform: translateY(-1px);

    box-shadow: 0 10px 24px rgba(37, 211, 102, 0.24);
}

.otp-verify-btn:active:not(:disabled) {
    transform: translateY(0);

    box-shadow: 0 5px 14px rgba(37, 211, 102, 0.18);
}

.otp-verify-btn:focus-visible {
    outline: 2px solid var(--app-primary-hover);
    outline-offset: 2px;
}

.otp-verify-btn:disabled {
    opacity: 0.55;

    cursor: not-allowed;

    box-shadow: none;

    transform: none;
}


/* --------------------------------------------------------------------------
   Error State (wrong OTP)
   -------------------------------------------------------------------------- */

.otp-inputs.is-invalid {
    animation: otp-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.otp-input.is-invalid,
.otp-input.is-invalid:hover,
.otp-input.is-invalid:focus {
    border-color: var(--app-danger, #dc3545);

    background-color: rgba(220, 53, 69, 0.05);
}

.otp-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

@keyframes otp-shake {
    10%, 90%      { transform: translateX(-2px); }
    20%, 80%      { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-7px); }
    40%, 60%      { transform: translateX(7px); }
}

@media (prefers-reduced-motion: reduce) {
    .otp-inputs.is-invalid {
        animation: none;
    }
}


/* --------------------------------------------------------------------------
   Divider ("Didn't receive the code?")
   -------------------------------------------------------------------------- */

.otp-divider {
    display: flex;

    align-items: center;

    gap: 14px;

    margin: 22px 0 12px;

    color: var(--app-text-muted);

    font-size: 13.5px;
}

.otp-divider::before,
.otp-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: var(--app-border);
}


/* --------------------------------------------------------------------------
   Resend OTP
   -------------------------------------------------------------------------- */

.otp-resend-wrapper {
    margin-top: 0;
}

.otp-resend-btn {
    padding: 4px 8px;

    border: none;

    background: transparent;

    color: var(--app-primary);

    font-size: 14.5px;
    font-weight: 600;

    cursor: pointer;
}

.otp-resend-btn:hover:not(:disabled) {
    color: var(--app-primary-hover);
}

.otp-resend-btn:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;

    border-radius: 6px;
}

.otp-resend-btn:disabled {
    color: var(--app-primary);

    opacity: 0.85;

    cursor: not-allowed;
}

#resendCountdown {
    font-variant-numeric: tabular-nums;
}


/* --------------------------------------------------------------------------
   Small Screens
   -------------------------------------------------------------------------- */

@media (max-width: 420px) {

    .otp-modal .modal-body {
        padding: 20px 20px 24px;
    }

    .otp-title {
        font-size: 1.4rem;
    }

    .otp-inputs {
        gap: 8px;
    }

    .otp-input {
        width: 40px;
        height: 48px;

        font-size: 18px;

        line-height: 48px;
    }
}
