/**
 * Gravity Forms OTP Verification Styles
 * 
 * Modern and responsive styling for OTP verification functionality
 */

/* Hide WP SMS Pro's verification button (top one) */
.gfield .wp-sms-verify-btn,
.gfield .wp-sms-verification-button,
.gfield button[onclick*="wp_sms"],
.gfield button[onclick*="verify"],
.gfield .gfield_description + button,
.gfield label + button {
    display: none !important;
}

/* Hide any verification buttons that appear above the input field */
.gfield .ginput_container button,
.gfield .gfield_description ~ button {
    display: none !important;
}

/* Only show our verification button */
.gfield .otp-verify-btn {
    display: inline-block !important;
}

/* OTP Verification Button */
.otp-verify-btn {
    background: #ed027c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    line-height: 1.4;
}

.otp-verify-btn:hover {
    background: #c8016a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(237, 2, 124, 0.3);
}

.otp-verify-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.otp-verify-btn.verified {
    background: #28a745;
    cursor: default;
    font-weight: 600;
    border: 2px solid #28a745;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.otp-verify-btn.verified:hover {
    background: #28a745;
    transform: none;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Phone Field Verification Status */
.gfield.phone-verified {
    position: relative;
}

.gfield.phone-verified::after {
    content: "✓ Verified";
    position: absolute;
    top: 0;
    right: 0;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* OTP Modal */
.otp-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.otp-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Close Button */
.otp-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.otp-close:hover,
.otp-close:focus {
    color: #000;
}

/* Modal Header */
.otp-modal-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.otp-modal-content p {
    margin: 0 0 25px 0;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* OTP Form */
.otp-form {
    margin-bottom: 20px;
}

.otp-step {
    margin-bottom: 20px;
}

.otp-step label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.otp-step input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin-bottom: 20px; /* Increased from 15px to 20px for more spacing */
}

.otp-step input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.otp-step input::placeholder {
    color: #999;
}

/* OTP Buttons */
.otp-btn {
    background: #ed027c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.otp-btn:hover {
    background: #c8016a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 2, 124, 0.3);
}

.otp-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.otp-btn-secondary {
    background: transparent;
    color: #ed027c;
    border: 2px solid #ed027c;
    padding: 10px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s ease;
}

.otp-btn-secondary:hover {
    background: #ed027c;
    color: white;
}

.otp-btn-secondary:disabled {
    background: transparent;
    color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* OTP Message */
.otp-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-top: 15px;
    min-height: 20px;
}

.otp-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.otp-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* OTP Code Input Styling */
#otp-code {
    text-align: center;
    letter-spacing: 4px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    .otp-modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
        max-width: 350px;
    }
    
    .otp-modal-content h3 {
        font-size: 20px;
    }
    
    .otp-step input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .otp-btn {
        padding: 14px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .otp-modal-content {
        margin: 5% auto;
        padding: 15px;
        width: 98%;
    }
    
    .otp-modal-content h3 {
        font-size: 18px;
    }
    
    .otp-modal-content p {
        font-size: 14px;
    }
}

/* Loading States */
.otp-btn.loading {
    position: relative;
    color: transparent;
}

.otp-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Gravity Forms Integration */
.gform_wrapper .gfield {
    position: relative;
}

.gform_wrapper .gfield.phone-verified input {
    border-color: #28a745;
    background-color: #f8fff9;
}

.gform_wrapper .gfield.phone-verified input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Error States */
.gform_wrapper .gfield.phone-error input {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.gform_wrapper .gfield.phone-error .gfield_description {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* Success Animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.otp-verify-btn.verified {
    animation: successPulse 0.6s ease;
}

/* Accessibility */
.otp-modal:focus {
    outline: none;
}

.otp-step input:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .otp-modal-content {
        border: 2px solid #000;
    }
    
    .otp-btn {
        border: 2px solid #0073aa;
    }
    
    .otp-btn-secondary {
        border: 2px solid #0073aa;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .otp-modal,
    .otp-modal-content,
    .otp-btn,
    .otp-verify-btn {
        animation: none;
        transition: none;
    }
} 

/* Disabled field styling */
.disabled-field {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    cursor: not-allowed !important;
    border-color: #ddd !important;
}

.disabled-field:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: #ddd !important;
}

/* Incorrect number message styling */
#incorrect-number-message {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
    line-height: 1.4;
}

/* Cancel link styling */
#otp-cancel-link {
    text-align: left;
    margin-top: 15px;
}

#otp-cancel-link a {
    color: #666;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
}

#otp-cancel-link a:hover {
    color: #333;
    text-decoration: none;
} 