/* Loading animation */
@keyframes ldta-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.ldta-btn-loading {
    animation: ldta-pulse 1.5s ease-in-out infinite;
}/* LearnDash Text Assignment Styles */
.ldta-container {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    direction: rtl;
    text-align: right;
}

.ldta-form-group {
    margin-bottom: 15px;
}

.ldta-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

#ldta-text {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: 'Tahoma', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
    direction: rtl;
}

#ldta-text:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.ldta-char-counter {
    text-align: left;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    direction: ltr;
}

#ldta-char-count {
    font-weight: bold;
}

.ldta-submit-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 120px;
}

.ldta-submit-btn:hover:not(:disabled) {
    background: #005a87;
}

.ldta-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ldta-btn-loading {
    display: none;
}

/* Messages */
.ldta-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid;
}

.ldta-message p {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
}

.ldta-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.ldta-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.ldta-pending {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Animation for form hide */
.ldta-container form {
    transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .ldta-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    #ldta-text {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .ldta-submit-btn {
        width: 100%;
        padding: 15px;
    }
}

/* Hide LearnDash default upload when text assignment exists */
.ldta-container .ldta-message.ldta-pending ~ * .learndash_assignment_message_shell,
.ldta-container .ldta-message.ldta-success ~ * .learndash_assignment_form_shell {
    display: none !important;
}

/* RTL Support */
[dir="rtl"] .ldta-container,
.rtl .ldta-container {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .ldta-char-counter,
.rtl .ldta-char-counter {
    text-align: left;
    direction: ltr;
}

/* Completion blocked message */
.ldta-completion-blocked {
    margin: 20px 0;
    padding: 0;
}

.ldta-completion-blocked .ldta-message {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
    border: 2px solid #ffc107;
    font-weight: bold;
}

/* Hide complete button when assignment is pending */
.ldta-completion-blocked ~ .learndash_mark_complete_button,
.ldta-completion-blocked + * .learndash_mark_complete_button {
    display: none !important;
}