/* Стили для модальных окон modal.css*/
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow: auto; /* Изменено: разрешаем скролл для модального фона */
}

/* Когда модальное окно открыто, блокируем скролл основной страницы */
body.modal-open {
    overflow: hidden;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    position: relative;
    margin: 20px 0; /* Добавляем отступы для маленьких экранов */
}

.ratings-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    margin: 20px 0; /* Добавляем отступы для маленьких экранов */
}

.ratings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0; /* Запрещаем сжатие хедера */
}

.ratings-modal-title {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-ratings {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-ratings:hover {
    background: #ef4444;
    color: white;
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    padding: 1.5rem 1.5rem 0;
}

/* Формы в модальных окнах */
.form-group {
    margin-bottom: 1.25rem;
    padding: 0 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    flex-wrap: wrap;
    flex-shrink: 0; /* Запрещаем сжатие футера */
}

.modal-buttons .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

/* Контент оценок */
#ratingsContent {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 200px; /* Минимальная высота для контента */
}

.user-rating-item {
    animation: fadeIn 0.3s ease;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.rating-date {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Секции оценок и комментариев */
.rating-section,
.comment-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #4f46e5;
}

.rating-question {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.user-rating-stars {
    margin-bottom: 0.5rem;
}

.user-rating-stars .star {
    font-size: 1.125rem;
}

.comment-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.user-comment {
    color: #4b5563;
    line-height: 1.5;
    font-size: 0.875rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.no-comment {
    color: #9ca3af !important;
    font-style: italic;
}

/* Навигация по оценкам */
.ratings-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0; /* Запрещаем сжатие навигации */
}

.ratings-counter {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-buttons {
    display: flex;
    gap: 0.75rem;
}

.nav-buttons .btn-outline {
    padding: 0.5rem 1rem;
    min-width: 80px;
    justify-content: center;
}

.nav-buttons .btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nav-buttons .btn-outline:disabled:hover {
    background: transparent;
    color: #4f46e5;
}

/* Сообщения */
.message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.message.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .modal-content,
    .ratings-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons .btn {
        width: 100%;
    }
    
    .ratings-navigation {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ratings-modal-header {
        padding: 1rem;
    }
    
    #ratingsContent {
        padding: 1rem;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .rating-section,
    .comment-section {
        padding: 0.75rem;
    }
}


/* Стили для модального окна подтверждения удаления */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fef2f2;
}

.modal-header h3 {
    margin: 0;
    color: #dc2626;
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 1.5rem;
    text-align: center;
}

.warning-icon {
    font-size: 3rem;
    color: #dc2626;
    margin-bottom: 1rem;
}

.warning-text {
    color: #ef4444;
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
    font-weight: 500;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

/* Стили для кнопки удаления */
.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    background: #fca5a5;
    color: #fecaca;
    cursor: not-allowed;
    transform: none;
}

.btn-danger:active:not(:disabled) {
    background: #b91c1c;
}

/* Стили для неактивной кнопки удаления */
.btn-disabled {
    background: #9ca3af;
    color: #d1d5db;
    cursor: not-allowed;
}

.btn-disabled:hover {
    background: #9ca3af;
    transform: none;
}

/* Стили для модального окна комментариев */
.comments-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    margin: 20px 0; /* Добавляем отступы для маленьких экранов */
}

.comments-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0; /* Запрещаем сжатие хедера */
}

.comments-modal-title {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
}

.comments-modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 200px; /* Минимальная высота для контента */
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
    flex-shrink: 0;
}

.comment-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
}

.comment-date {
    color: #6b7280;
    font-size: 0.75rem;
}

.comment-text {
    color: #374151;
    line-height: 1.5;
    font-size: 0.875rem;
}

.comment-form {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    flex-shrink: 0; /* Запрещаем сжатие формы */
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    margin-bottom: 1rem;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.loading, .no-comments {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.no-comments i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.no-comments p {
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.no-comments small {
    color: #9ca3af;
}

/* Стили для модального окна оценки урока */
.rating-questions-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 300px; /* Минимальная высота для вопросов */
}

.rating-question-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    flex-shrink: 0; /* Запрещаем сжатие вопросов */
}

.question-header {
    margin-bottom: 1rem;
}

.question-title {
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.question-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.4;
}

.rating-stars-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stars-selector {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.star-label {
    cursor: pointer;
    padding: 0.25rem;
}

.star-label input {
    display: none;
}

.star-icon {
    font-size: 2rem;
    color: #d1d5db;
    transition: all 0.2s ease;
    display: block;
}

.star-icon.selected {
    color: #fbbf24;
}

.star-icon.hover {
    color: #fcd34d;
}

.star-label:hover .star-icon {
    transform: scale(1.1);
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Адаптивность для модального окна оценки */
@media (max-width: 768px) {
    .stars-selector {
        gap: 0.125rem;
    }
    
    .star-icon {
        font-size: 1.75rem;
    }
    
    .rating-question-item {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .star-icon {
        font-size: 1.5rem;
    }
    
    .question-title {
        font-size: 0.875rem;
    }
}

/* Улучшаем внешний вид скроллбара */
#ratingsContent::-webkit-scrollbar,
.comments-modal-body::-webkit-scrollbar,
.rating-questions-container::-webkit-scrollbar,
.comments-list::-webkit-scrollbar {
    width: 6px;
}

#ratingsContent::-webkit-scrollbar-track,
.comments-modal-body::-webkit-scrollbar-track,
.rating-questions-container::-webkit-scrollbar-track,
.comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#ratingsContent::-webkit-scrollbar-thumb,
.comments-modal-body::-webkit-scrollbar-thumb,
.rating-questions-container::-webkit-scrollbar-thumb,
.comments-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#ratingsContent::-webkit-scrollbar-thumb:hover,
.comments-modal-body::-webkit-scrollbar-thumb:hover,
.rating-questions-container::-webkit-scrollbar-thumb:hover,
.comments-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Специальные стили для модального окна оценки урока */
#rateLessonModal.modal {
    align-items: flex-start; /* ← ВЫРАВНИВАЕМ ПО ВЕРХУ */
    padding-top: 20px; /* ← ДОБАВЛЯЕМ ОТСТУП СВЕРХУ */
}

#rateLessonModal .ratings-modal-content {
    max-height: none;
    height: auto;
    overflow: visible;
    margin-top: 0; /* ← УБИРАЕМ MARGIN Т.К. ЕСТЬ PADDING У РОДИТЕЛЯ */
}

#rateLessonModal .rating-questions-container {
    min-height: auto;
    max-height: none;
    overflow: visible;
}
