/**
 * Math Captcha Styles
 */
.math-captcha-container {
    display: flex;
    align-items: center;
    background-color: #f7f7f7;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
    position: relative;
}

.math-captcha-question {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-right: 15px;
    background-color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-grow: 1;
    display: flex;
    align-items: center;
    min-height: 36px;
}

.math-captcha-input {
    flex: 1;
    max-width: 220px;
    min-width: 120px;
    min-height: 36px;
    height: 36px;
    padding-right: 8px;
    padding-left: 8px;
    box-sizing: border-box;
}

/* Refresh button styles */
.math-captcha-refresh {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    width: auto;
    height: auto;
    line-height: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.math-captcha-refresh:hover {
    background-color: #f1f1f1;
    border-color: #bbb;
}

.math-captcha-refresh svg {
    width: 16px;
    height: 16px;
    color: #666;
}

/* Dark mode styles */
.elementor-dark-mode .math-captcha-container {
    background-color: #2c2d31;
    border-color: #4a4b50;
}

.elementor-dark-mode .math-captcha-question {
    background-color: #34383C;
    color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.elementor-dark-mode .math-captcha-refresh {
    background-color: #34383C;
    border-color: #4a4b50;
}

.elementor-dark-mode .math-captcha-refresh:hover {
    background-color: #3e4246;
    border-color: #5a5b60;
}

.elementor-dark-mode .math-captcha-refresh svg {
    color: #e0e0e0;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
    .math-captcha-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .math-captcha-question {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
        text-align: center;
    }
    
    .math-captcha-input {
        width: 100%;
        max-width: 100%;
    }
    
    .math-captcha-refresh {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

.math-captcha-image{max-height:32px;display:block;}

.math-captcha-check{
    background-color:#4caf50;
    border:1px solid #4caf50;
    color:#fff;
    border-radius:4px;
    padding:6px;
    width:auto;
    height:auto;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    margin-left:10px;
    transition:all .2s;
}

.math-captcha-check:hover{background-color:#45a045}
.math-captcha-check svg{width:16px;height:16px;color:#fff}

.math-captcha-error{animation:shake 0.5s;border-color:#ff5252!important}.math-captcha-error .math-captcha-container{border-color:#ff5252!important;background-color:#fff0f0}@keyframes shake{0%{transform:translateX(0)}20%{transform:translateX(-10px)}40%{transform:translateX(10px)}60%{transform:translateX(-10px)}80%{transform:translateX(10px)}100%{transform:translateX(0)}} 

/* Add specific styles for field error */
.elementor-field-group.math-captcha-error {
    position: relative;
}

.elementor-field-group.math-captcha-error::after {
    content: attr(data-error);
    display: block;
    color: #ff5252;
    font-size: 14px;
    margin-top: 5px;
    font-weight: 500;
}

.elementor-field-group.math-captcha-error .math-captcha-container {
    border-color: #ff5252 !important;
    background-color: rgba(255, 82, 82, 0.05);
}

.elementor-field-group.math-captcha-error .math-captcha-input {
    border-color: #ff5252 !important;
}

/* Error message for both LTR and RTL */
.elementor-form-message.elementor-message-danger {
    color: #ff5252;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 4px;
    background-color: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.3);
    margin-bottom: 15px;
}

/* RTL Support for Arabic, Persian and other RTL languages */
html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-container,
html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-field-wrapper,
html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-button-wrapper {
    direction: rtl;
    text-align: right;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-container {
    height: auto;
    min-height: 50px;
    padding: 12px 15px;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-question {
    margin-right: 0;
    margin-left: 15px;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-image {
    margin-right: 0;
    margin-left: 10px;
    height: 36px;
    max-height: 36px;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-refresh {
    margin-left: 0;
    margin-right: 10px;
    height: auto;
    width: auto;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-message {
    text-align: right;
}

html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-check {
    margin-left: 0;
    margin-right: 10px;
    height: auto;
    width: auto;
}

/* Additional styles for better RTL support */
html[dir="rtl"] .elementor-field-type-math_captcha input.elementor-field {
    text-align: right;
    min-height: 36px;
    height: 36px;
    width: 100px;
}

/* Error message in RTL */
html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-error {
    text-align: right;
}

/* Success message in RTL */
html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-success {
    text-align: right;
}

/* Responsive design for RTL */
@media screen and (max-width: 768px) {
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-question {
        margin-left: 0;
        margin-bottom: 10px;
        width: 100%;
    }
    
    html[dir="rtl"] .elementor-field-type-math_captcha input.elementor-field {
        width: 100%;
    }
    
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-check,
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-refresh {
        position: absolute;
        top: 10px;
    }
    
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-refresh {
        left: 10px;
        right: auto;
    }
    
    html[dir="rtl"] .elementor-field-type-math_captcha .math-captcha-check {
        left: 50px;
        right: auto;
    }
} 