/* ============================================
   Secure Checkout Plus - OTP Modal Styles
   ============================================ */

/* ============================================
   iOS Auto-Zoom Fix
   --------------------------------------------
   iOS Safari zooms in whenever an input has
   font-size < 16px. Force 16px on all checkout
   inputs to keep the page fit on screen.
   ============================================ */
@media screen and (max-width: 768px) {
    .woocommerce-checkout input[type="text"],
    .woocommerce-checkout input[type="email"],
    .woocommerce-checkout input[type="tel"],
    .woocommerce-checkout input[type="number"],
    .woocommerce-checkout input[type="password"],
    .woocommerce-checkout input[type="search"],
    .woocommerce-checkout input[type="url"],
    .woocommerce-checkout textarea,
    .woocommerce-checkout select,
    .woocommerce-checkout .input-text,
    .woocommerce-checkout .select2-selection__rendered,
    form.checkout input[type="text"],
    form.checkout input[type="email"],
    form.checkout input[type="tel"],
    form.checkout input[type="number"],
    form.checkout input[type="password"],
    form.checkout textarea,
    form.checkout select,
    form.checkout .input-text {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
        -webkit-appearance: none;
    }

    /* Prevent body-level zoom shift */
    html, body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* Overlay */
#otpOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Modal container */
#otpModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: 90%;
    max-width: 400px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
}

#otpModal .scp-modal-inner {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem 1.75rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: scp-modal-pop 0.25s ease-out;
}

@keyframes scp-modal-pop {
    0% { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

/* Shield icon circle */
#otpModal .scp-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: #FCE7EF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D4537E;
}

/* Title */
#otpModal h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: #2C2C2A;
    line-height: 1.3;
    padding: 0;
    border: none;
}

#otpModal .scp-sub {
    margin: 0 0 2px;
    font-size: 14px;
    color: #5F5E5A;
    line-height: 1.5;
}

#otpModal .scp-sub + .scp-sub {
    margin-bottom: 1.25rem;
}

/* Phone pill */
#otpModal .scp-phone-pill {
    background: #FCE7EF;
    color: #993556;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
    font-size: 13px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* OTP boxes row */
#otpModal .scp-otp-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.25rem;
}

#otpModal .scp-otp-box {
    width: 56px !important;
    height: 64px !important;
    text-align: center;
    font-size: 24px !important;
    font-weight: 600;
    border: 2px solid #E5E5E5;
    border-radius: 12px;
    outline: none;
    background: #FAFAFA;
    color: #2C2C2A;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    transition: all 0.15s ease;
    -moz-appearance: textfield;
}

#otpModal .scp-otp-box::-webkit-outer-spin-button,
#otpModal .scp-otp-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#otpModal .scp-otp-box:focus {
    border-color: #D4537E;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(212, 83, 126, 0.15);
}

#otpModal .scp-otp-box.filled {
    border-color: #D4537E;
    background: #FCE7EF;
    color: #2C2C2A;
}

#otpModal .scp-otp-box.filled-success {
    border-color: #0F6E56;
    background: #E1F5EE;
    color: #0F6E56;
}

/* Shake animation for wrong OTP */
@keyframes scp-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
#otpModal .scp-shake {
    animation: scp-shake 0.4s ease-in-out;
    border-color: #A32D2D !important;
    background: #FCEBEB !important;
}

/* Status message */
#otpModal .scp-status {
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 1rem;
    color: #5F5E5A;
    line-height: 1.4;
}

#otpModal .scp-status.scp-error {
    color: #A32D2D;
}

#otpModal .scp-status.scp-success {
    color: #0F6E56;
    font-weight: 500;
}

/* Primary button */
#otpModal .scp-btn-primary {
    width: 100%;
    padding: 14px;
    background: #D4537E;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    margin-bottom: 14px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#otpModal .scp-btn-primary:hover:not(:disabled) {
    background: #B83968;
}

#otpModal .scp-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

#otpModal .scp-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
@keyframes scp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
#otpModal .scp-spin {
    animation: scp-spin 0.8s linear infinite;
}

/* Resend wrap */
#otpModal .scp-resend-wrap {
    font-size: 13px;
    color: #5F5E5A;
    margin-bottom: 4px;
}

#otpModal .scp-resend-wrap strong {
    color: #2C2C2A;
    font-weight: 600;
}

#otpModal .scp-resend-btn {
    background: none;
    border: none;
    color: #D4537E;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
}

#otpModal .scp-resend-btn:hover {
    color: #B83968;
}

/* Cancel */
#otpModal .scp-cancel-wrap {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #F0F0F0;
}

#otpModal .scp-cancel-btn {
    background: none;
    border: none;
    color: #888780;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

#otpModal .scp-cancel-btn:hover {
    color: #2C2C2A;
}

/* Hide native OTP field — modal owns it */
#otp_code_field {
    display: none !important;
}

/* Mobile tweaks */
@media (max-width: 480px) {
    #otpModal {
        width: calc(100% - 24px);
        max-width: none;
    }
    #otpModal .scp-modal-inner {
        padding: 1.75rem 1.25rem;
    }
    #otpModal .scp-otp-row {
        gap: 8px;
    }
    #otpModal .scp-otp-box {
        width: 52px !important;
        height: 60px !important;
        font-size: 22px !important;
    }
}
