/* OTP Verification Popup Styles - Fixed Version */

.otp-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999998;
    overflow-y: auto;
    padding: 20px;
}

.otp-popup-overlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.otp-popup {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 440px;
    width: 100%;
    padding: 35px 30px;
    position: relative;
    z-index: 999999;
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.otp-popup h2 {
    margin: 0 0 8px 0;
    font-size: 26px;
    color: #1a1a1a;
    font-weight: 700;
    text-align: center;
}

.otp-popup-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.5;
}

.otp-form-group {
    margin-bottom: 18px;
}

.otp-form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.otp-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: inherit;
}

.otp-form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.otp-form-group input::placeholder {
    color: #999;
}

.otp-button-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.otp-btn {
    flex: 1;
    padding: 13px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.otp-btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.otp-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.otp-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.otp-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.otp-btn-secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.otp-btn-secondary:hover {
    background-color: #e8e8e8;
    border-color: #d0d0d0;
}

/* Stage Management */
.otp-stage-1,
.otp-stage-2 {
    display: block;
}

.otp-stage-1.hidden {
    display: none !important;
}

.otp-stage-2 {
    display: none;
}

.otp-stage-2.active {
    display: block !important;
}

/* Loading State */
.otp-loading {
    display: none;
    text-align: center;
    padding: 30px 20px;
}

.otp-loading.active {
    display: block !important;
}

.otp-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.otp-loading p {
    color: #666;
    font-size: 15px;
    margin: 0;
}

/* Messages */
.otp-error {
    background-color: #fee;
    color: #c33;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    display: none;
    border-left: 4px solid #c33;
    line-height: 1.5;
}

.otp-error.active {
    display: block !important;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.otp-success {
    background-color: #d4edda;
    color: #155724;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    display: none;
    border-left: 4px solid #28a745;
    line-height: 1.5;
}

.otp-success.active {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.otp-info {
    background-color: #e7f3ff;
    color: #004085;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    border-left: 4px solid #2196F3;
    line-height: 1.5;
}

.otp-info strong {
    font-weight: 700;
}

/* Resend Section */
.otp-resend {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 14px;
}

.otp-resend a {
    color: #4CAF50;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.otp-resend a:hover {
    text-decoration: underline;
    color: #45a049;
}

/* Timer Text */
#otpTimer {
    color: #666;
    font-weight: 500;
    font-size: 13px;
}

/* Help Text */
.otp-help-text {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #666;
}

.otp-help-text a {
    color: #4CAF50;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.otp-help-text a:hover {
    text-decoration: underline;
    color: #45a049;
}

/* Responsive Design */
@media (max-width: 600px) {
    .otp-popup-overlay {
        padding: 15px;
    }
    
    .otp-popup {
        width: 100%;
        padding: 25px 20px;
        max-width: 100%;
    }

    .otp-popup h2 {
        font-size: 22px;
    }
    
    .otp-popup-subtitle {
        font-size: 13px;
    }
    
    .otp-form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .otp-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .otp-button-group {
        flex-direction: column;
    }
    
    .otp-btn {
        width: 100%;
    }
}

/* Accessibility */
.otp-form-group input:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.otp-btn:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .otp-popup-overlay {
        display: none !important;
    }
}