/* ================================================
   Custom OTP Authentication Styles
   ================================================ */

/* General Styles */
.custom-otp-phone-field,
.custom-otp-registration-form,
.custom-otp-login-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Phone Field */
.custom-otp-phone-field label,
.custom-otp-registration-form label,
.custom-otp-login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #1e1e1e;
}

.custom-otp-phone-field .required,
.custom-otp-registration-form .required,
.custom-otp-login-form .required {
    color: #d63638;
    font-weight: 700;
}

.custom-otp-phone-field input[type="tel"],
.custom-otp-registration-form input[type="tel"],
.custom-otp-login-form input[type="tel"] {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.custom-otp-phone-field input[type="tel"]:focus,
.custom-otp-registration-form input:focus,
.custom-otp-login-form input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.custom-otp-phone-field .description,
small.description {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #646970;
    font-style: italic;
}

/* OTP Verification Section */
#otp-verification-section {
    background: #f0f6fc;
    border: 1px solid #c3d7e8;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

#otp-input-wrapper,
#reg-otp-section,
#login-otp-section,
#login-otp-verify-wrapper {
    margin-top: 15px;
}

/* OTP Input Field */
input[type="text"][id$="otp"],
input[type="text"][id$="otp_code"] {
    width: 150px !important;
    font-size: 24px !important;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    padding: 12px !important;
    border: 2px solid #2271b1 !important;
    border-radius: 6px;
    background: #fff;
}

input[type="text"][id$="otp"]:focus,
input[type="text"][id$="otp_code"]:focus {
    border-color: #135e96 !important;
    box-shadow: 0 0 0 2px rgba(33, 113, 177, 0.2) !important;
}

/* Buttons */
.button,
button.button,
#send-otp-btn,
#verify-otp-btn,
#resend-otp-btn,
#login-send-otp-btn,
#login-verify-otp-btn,
#login-resend-otp-btn,
#reg-send-otp,
#reg-verify-otp,
#login-send-otp,
#login-verify-otp {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: #2271b1;
    border: 1px solid #2271b1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 10px;
}

.button:hover,
button.button:hover {
    background: #135e96;
    border-color: #135e96;
}

.button.loading,
button.button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.button.loading::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    right: 10px;
    margin-top: -7px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.button-secondary,
#resend-otp-btn,
#login-resend-otp-btn {
    background: #f6f7f7;
    border-color: #8c8f94;
    color: #2c3338;
}

.button-secondary:hover {
    background: #e9ecef;
    border-color: #646970;
}

/* Status Messages */
#otp-status-message,
#login-otp-status,
#woo-otp-status,
#resend-timer {
    display: inline-block;
    margin-left: 15px;
    font-weight: 600;
    font-size: 14px;
}

#otp-status-message.success,
#login-otp-status.success,
#woo-otp-status.success,
.success {
    color: #00a32a;
}

#otp-status-message.error,
#login-otp-status.error,
#woo-otp-status.error,
.error {
    color: #d63638;
}

#resend-timer {
    color: #646970;
    font-weight: 400;
}

/* Verification Badge */
.otp-verified-badge {
    display: inline-block;
    padding: 8px 15px;
    background: #edfaef;
    border: 1px solid #68de7c;
    border-radius: 4px;
    color: #00a32a;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Registration & Login Forms */
.custom-otp-registration-form,
.custom-otp-login-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.custom-otp-registration-form p,
.custom-otp-login-form p {
    margin-bottom: 20px;
}

.custom-otp-registration-form input[type="text"],
.custom-otp-registration-form input[type="email"],
.custom-otp-registration-form input[type="tel"],
.custom-otp-registration-form input[type="password"],
.custom-otp-login-form input[type="text"],
.custom-otp-login-form input[type="tel"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    box-sizing: border-box;
}

.custom-otp-registration-form .submit,
.custom-otp-login-form .submit {
    margin-top: 20px;
}

.custom-otp-registration-form .button-primary,
.custom-otp-login-form .button-primary {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* Form Messages */
#reg-message,
#login-message {
    padding: 12px 15px;
    margin: 20px 0;
    border-radius: 4px;
    font-weight: 600;
}

#reg-message.success,
#login-message.success {
    background: #edfaef;
    border: 1px solid #68de7c;
    color: #00a32a;
}

#reg-message.error,
#login-message.error {
    background: #fcf0f1;
    border: 1px solid #f86368;
    color: #d63638;
}

/* WooCommerce Integration */
.woocommerce-checkout-otp {
    background: #f7f7f7;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 20px 0;
}

.woocommerce-checkout-otp h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #2c3338;
}

#woo-otp-verify {
    margin-top: 15px;
}

#woo_otp_code {
    width: 150px;
    font-size: 20px;
    letter-spacing: 5px;
    text-align: center;
    padding: 10px;
    margin-right: 10px;
}

/* WordPress Login Page Specific */
.login #otp-login-wrapper {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.login .login-toggle-wrapper {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.login .login-toggle-wrapper a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
}

.login .login-toggle-wrapper a:hover {
    color: #135e96;
    text-decoration: underline;
}

.login .button-large {
    width: 100%;
    height: 44px;
    line-height: 44px;
    padding: 0;
    font-size: 16px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .custom-otp-phone-field input[type="tel"],
    input[type="text"][id$="otp"],
    input[type="text"][id$="otp_code"] {
        max-width: 100%;
    }
    
    .custom-otp-registration-form,
    .custom-otp-login-form {
        padding: 20px;
    }
    
    .button,
    #send-otp-btn,
    #verify-otp-btn,
    #resend-otp-btn {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
    
    #otp-status-message,
    #login-otp-status,
    #resend-timer {
        display: block;
        margin: 10px 0;
    }
}

/* Accessibility */
.button:focus,
input:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.button:disabled,
.button.loading {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Admin Bar Adjustment */
.admin-bar .custom-otp-registration-form,
.admin-bar .custom-otp-login-form {
    margin-top: 32px;
}

/* Loading Spinner for Buttons */
.button.loading {
    padding-right: 40px;
}

/* Success Animation */
@keyframes checkmark {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.otp-verified-badge {
    animation: checkmark 0.5s ease-in-out;
}

/* Print Styles */
@media print {
    #otp-verification-section,
    .custom-otp-registration-form,
    .custom-otp-login-form {
        display: none;
    }
}
