/* Стили для модального окна добавления вопросов */
.modal-content {
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(to right, #4361ee, #3a0ca3);
    color: white;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    align-items: center; /* Выравнивание по центру вертикально */
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center; /* Центрируем элементы в заголовке */
}

.modal-title i {
    margin-right: 0.75rem;
    display: flex; /* Гарантируем правильное отображение иконки */
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.5rem;
    background-color: #ffffff;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    justify-content: space-between; /* Распределяем кнопки по краям */
}

/* Стили для формы вопроса */
#questionForm .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

#questionForm .form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.75rem;
    transition: border-color 0.15s ease-in-out;
}

#questionForm .form-control:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

#questionText {
    min-height: 100px;
    resize: vertical;
}

/* Скрытие CSRF токена */
input[name="csrfmiddlewaretoken"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
}

/* Стили для вариантов ответов */
#answersContainer {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

/* Стили для строки ответа */
.answer-row {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    display: flex;
}

.answer-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.answer-row:last-child {
    margin-bottom: 0;
}

.answer-row .form-check {
    min-width: 110px;
    display: flex;
    align-items: center; /* Центрируем чекбокс и метку */
}

.answer-row .flex-grow-1 {
    /* width: calc(100% - 60px); Removed restriction */
}

.answer-row .form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 0; /* Убираем смещение по умолчанию */
}

.answer-row .form-check-label {
    padding-left: 0.5rem;
    font-weight: 500;
    margin-bottom: 0; /* Убираем отступ снизу */
    display: flex;
    align-items: center;
}

.answer-row .form-control {
    border-radius: 6px;
    width: 100%;
    border: 1px solid #ced4da;
}

/* Стилизованный чекбокс */
.checkbox-styled {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    flex-shrink: 0;
    margin-right: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.checkbox-styled .form-check-input {
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
    border: 2px solid #4361ee;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
}

/* Анимация выделения для чекбоксов */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(67, 97, 238, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}

@keyframes pulse-warning {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

@keyframes pulse-error {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.highlight-checkbox {
    animation: pulse 1s infinite;
}

.highlight-checkbox .form-check-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

.highlight-checkbox-warning {
    animation: pulse-warning 1s infinite;
}

.highlight-checkbox-warning .form-check-input {
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.25) !important;
}

.highlight-checkbox-error {
    animation: pulse-error 1s infinite;
}

.highlight-checkbox-error .form-check-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

/* Стили для полей ввода ответов */
.answer-row .form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.answer-row .form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Стили для кнопок */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center; /* Центрируем содержимое кнопок */
}

.btn i {
    margin-right: 0.5rem;
    display: flex; /* Гарантируем правильное отображение иконки */
    align-items: center;
    justify-content: center;
}

#addAnswerBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: 2px dashed #ced4da;
    background-color: #f8f9fa;
    color: #6c757d;
}

#addAnswerBtn:hover {
    border-color: #4361ee;
    background-color: #e9ecef;
    color: #4361ee;
}

.remove-answer-btn {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center; /* Точно центрируем иконку */
}

.remove-answer-btn i {
    margin-right: 0; /* Убираем отступ для иконки в круглой кнопке */
}

.btn-primary {
    background-color: #4361ee;
    border-color: #4361ee;
}

.btn-primary:hover {
    background-color: #3a0ca3;
    border-color: #3a0ca3;
}



.btn-danger {
    background-color: #e63946;
    border-color: #e63946;
}

.btn-danger:hover {
    background-color: #d62828;
    border-color: #d62828;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show .modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* Стили для карточек вопросов в списке */
.question-card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.question-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.question-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1.25rem;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.question-card .card-body {
    padding: 1.25rem;
}

.question-card .card-body p {
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.delete-question-btn {
    padding: 0.25rem 0.5rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.delete-question-btn:hover {
    background-color: #c82333;
}

.delete-question-btn i {
    margin-right: 0.4rem;
    font-size: 0.875rem;
}

/* Анимация удаления */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.question-card.deleting {
    animation: fadeOut 0.5s forwards;
}

/* Стили для уведомлений */
.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateY(20px);
    animation: toast-in 0.3s ease-out forwards;
    z-index: 9999;
}

@keyframes toast-in {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.toast.hide {
    animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-out {
    from { 
        opacity: 1; 
        transform: translateY(0); 
    }
    to { 
        opacity: 0; 
        transform: translateY(20px); 
    }
}

.toast .toast-body {
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.toast.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.toast.bg-warning .btn-close {
    filter: none;
}

.toast i {
    font-size: 1.25rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .answer-row {
        flex-direction: column;
    }
    
    .answer-row .form-check {
        margin-bottom: 0.5rem;
        justify-content: center; /* Центрируем на мобильных устройствах */
    }
    
    .remove-answer-btn {
        margin-top: 0.5rem;
        align-self: center; /* Центрируем кнопку удаления */
    }
}
