/* Gravity Forms OTP Verification Styles */

.gf-otp-controls {
    margin-top: 8px;
    margin-bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gf-otp-send-btn {
    background: #009490;
    color: white;
    border: 1px solid #009490;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 200px;
    text-align: center;
    box-sizing: border-box;
}

.gf-otp-send-btn:hover:not(:disabled) {
    background: #009490;
    transform: translateY(-1px);
}

.gf-otp-send-btn:disabled {
    background: #384b4a;
    border-color: #384b4a;
    color: #6a8180;
    cursor: not-allowed;
    transform: none;
}

.gf-otp-send-btn:active {
    transform: translateY(0);
}

.gf-otp-spinner {
    font-size: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gf-otp-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.gf-otp-message.gf-otp-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gf-otp-message.gf-otp-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gf-otp-message.gf-otp-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* OTP Field Styling */
.gf-otp-field input[type="text"] {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.gf-otp-field input[type="text"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.gf-otp-field input[type="text"].gf-otp-verified {
    border-color: #28a745;
    background: #f8fff9;
}

/* Submit Button States */
.gform_button.gf-otp-disabled,
input[type="submit"].gf-otp-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Verification Notice */
.gf-otp-verification-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 0;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
    font-weight: 500;
    animation: gf-otp-notice-fade-in 0.3s ease-in;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    /* Force to new line in flex containers */
    flex-basis: 100%;
    order: 999;
}

.gf-otp-notice-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.gf-otp-notice-text {
    flex: 1;
}

/* Highlight effect when user tries to submit without verification */
.gf-otp-verification-notice.gf-otp-notice-highlight {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    animation: gf-otp-notice-pulse 0.5s ease-in-out;
}

@keyframes gf-otp-notice-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gf-otp-notice-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .gf-otp-send-btn {
        width: 100%;
        max-width: none;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .gf-otp-field input[type="text"] {
        font-size: 16px;
        padding: 10px;
    }
    
    .gf-otp-verification-notice {
        padding: 10px 12px;
        font-size: 13px;
        margin-top: 12px;
        margin-bottom: 0;
    }
    
    .gf-otp-notice-icon {
        font-size: 14px;
    }
}

/* Legacy theme support */
.gform_legacy .gf-otp-controls {
    margin-top: 10px;
}

.gform_legacy .gf-otp-send-btn {
    max-width: 250px;
}

/* Animation for field appearance */
.gfield {
    transition: all 0.3s ease;
}

.gfield.gf-otp-field-hidden {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.gfield.gf-otp-field-visible {
    opacity: 1;
    max-height: 200px;
}

/* Loading states */
.gf-otp-loading {
    position: relative;
}

.gf-otp-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gravity Forms Integration */
.gform_wrapper .gf-otp-controls {
    margin: 8px 0 0 0;
    grid-column: 1 / -1; /* Span full width in grid */
}

.gform_wrapper .gf-otp-send-btn {
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Ensure proper positioning within gfield */
.gfield .gf-otp-controls {
    position: relative;
    z-index: 1;
    clear: both;
}

/* Grid layout compatibility */
.gform_fields .gfield .gf-otp-controls {
    width: 100%;
    display: block;
}

/* Responsive grid adjustments */
@media (min-width: 641px) {
    .gform_wrapper.gravity-theme .gform_fields .gfield .gf-otp-controls {
        grid-column: 1 / -1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gf-otp-send-btn {
        border: 2px solid currentColor;
    }
    
    .gf-otp-message {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gf-otp-send-btn,
    .gfield,
    .gf-otp-spinner {
        transition: none;
        animation: none;
    }
}
