/* Основные стили для симулятора судебного заседания */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #4a4a3a;
    background: #e8f5e9;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Специальные стили для игрового контейнера */
#game-section .container {
    padding: 0; /* Убираем отступы для игровой секции */
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* Заголовок */
.header {
    text-align: center;
    background: #f5f0e8;
    padding: 40px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid #d4c4b0;
}

.header h1 {
    color: #6b5d4f;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

.header h1 i {
    color: #8b6f5f;
    margin-right: 15px;
}

.header p {
    color: #6b5d4f;
    font-size: 1.1em;
}

/* Основной контент */
.main-content {
    flex: 1;
    background: #f5f0e8;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #d4c4b0;
}

.section {
    margin-bottom: 0; /* Убираем отступы между секциями */
}

/* Специальные стили для игровой секции */
#game-section {
    margin: 0;
    padding: 0;
    width: 100%;
}

.section h2 {
    color: #6b5d4f;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 2px solid #b8a895;
    padding-bottom: 10px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #6b5d4f;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #b8a895;
    box-shadow: 0 0 0 3px rgba(184, 168, 149, 0.15);
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #a88999;
    color: white;
    border: 1px solid #a88999;
}

.btn-primary:hover {
    background: #987889;
    border-color: #987889;
}

.btn-secondary {
    background: #b8a895;
    color: white;
    border: 1px solid #b8a895;
}

.btn-secondary:hover {
    background: #a89885;
    border-color: #a89885;
}

.btn-warning {
    background: #c9b8a3;
    color: #4a4a3a;
    border: 1px solid #c9b8a3;
}

.btn-warning:hover {
    background: #b9a893;
    border-color: #b9a893;
}

.btn-info {
    background: #b8d4b8;
    color: #4a4a3a;
    border: 1px solid #b8d4b8;
}

.btn-info:hover {
    background: #a8c4a8;
    border-color: #a8c4a8;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Игровая область */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f0e8;
    color: #4a4a3a;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #d4c4b0;
}

.session-info h3 {
    margin-bottom: 10px;
    font-size: 1.5em;
}

.session-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f5f0e8;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #d4c4b0;
    color: #4a4a3a;
}

/* Материалы дела */
.case-content {
    background: #f0f0e8;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #b8a895;
}

.case-content h4 {
    color: #4a4a3a;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.case-text {
    line-height: 1.8;
    color: #4a4a3a;
    white-space: pre-wrap;
}

/* Область диалога */
.dialogue-area {
    background: #f5f0e8;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.messages-container {
    /* Убрана фиксированная высота - контейнер растягивается по содержимому */
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f0e8;
    border-radius: 8px;
    border: 1px solid #d4c4b0;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 10px;
    /* Убрана фиксированная ширина - реплики подстраиваются под размер окна */
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    box-sizing: border-box;
}

.message.user {
    background: #a88999;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.judge {
    background: #b8a895;
    color: white;
}

.message.system {
    background: #c9b8a3;
    color: #4a4a3a;
    text-align: center;
    margin: 0 auto;
}

.message-header {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9em;
    opacity: 0.9;
}

.message-content {
    line-height: 1.5;
}

.message-time {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
}

/* Область ввода */
.input-area {
    border-top: 2px solid #d4c4b0;
    padding-top: 20px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.input-group textarea:focus {
    outline: none;
    border-color: #b8a895;
    box-shadow: 0 0 0 3px rgba(184, 168, 149, 0.15);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #f5f0e8;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #d4c4b0;
    background: #e8d4c4;
    color: #4a4a3a;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #8b6f5f;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 2px solid #d4c4b0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Футер */
.footer {
    text-align: center;
    padding: 20px;
    color: #8b6f5f;
    margin-top: 30px;
}

/* Утилиты */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.message {
    animation: fadeIn 0.3s ease;
}

/* Стили для истории ошибок */
.errors-list {
    max-height: 400px;
    overflow-y: auto;
}

.error-item {
    background: #f0f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d4c4b0;
}

.error-time {
    color: #4a4a3a;
    font-size: 0.9em;
}

.error-description,
.error-article,
.error-analysis {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #4a4a3a;
}

.error-status {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #d4c4b0;
}

.status-correct {
    color: #6b5d4f;
    font-weight: 600;
}

.status-incorrect {
    color: #4a4a3a;
    font-weight: 600;
}

/* Стили для справки */
.help-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #f0f0e8;
    border-radius: 8px;
    border-left: 4px solid #b8a895;
}

.help-section h4 {
    color: #4a4a3a;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.help-section ul,
.help-section ol {
    margin-left: 20px;
}

.help-section li {
    margin-bottom: 5px;
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 0;
    }
    
    .header {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .main-content {
        padding: 10px;
        margin: 0;
    }
    
    .section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .session-stats {
        justify-content: center;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .message {
        max-width: 95%;
    }
    
    .error-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Стили для подсказок */
.hints-panel {
    background: #e8f0e8;
    border: 2px solid #a8d5a8;
    border-radius: 10px;
    margin-bottom: 20px;
    padding: 0;
    box-shadow: 0 4px 6px rgba(168, 213, 168, 0.15);
}

.hints-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #b8d4b8;
    color: #4a4a3a;
    border-radius: 8px 8px 0 0;
    margin: 0;
}

.hints-header h4 {
    margin: 0;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hints-header h4 i {
    color: #4a4a3a;
}

.hints-content {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.hint-item {
    background: #f5f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.hint-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.hint-item:last-child {
    margin-bottom: 0;
}

.hint-title {
    font-weight: 600;
    color: #4a4a3a;
    margin-bottom: 8px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hint-content {
    color: #4a4a3a;
    line-height: 1.6;
    white-space: pre-wrap;
}

.hint-type-general .hint-title {
    color: #4a4a3a;
}

.hint-type-general {
    border-left: 4px solid #b8d4b8;
}

.hint-type-error_hint .hint-title {
    color: #4a4a3a;
}

.hint-type-error_hint {
    border-left: 4px solid #c9a9a9;
}

.hint-type-action_hint .hint-title {
    color: #4a4a3a;
}

.hint-type-action_hint {
    border-left: 4px solid #c9b8a3;
}

.btn-success {
    background: #a8d5a8;
    color: #4a4a3a;
    border: 1px solid #a8d5a8;
}

.btn-success:hover {
    background: #98c598;
    border-color: #98c598;
}

/* Стили для демо-инструкций */
.demo-instructions {
    background: #f0e8d8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.demo-instructions h4 {
    color: #4a4a3a;
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.demo-instructions h4 i {
    color: #4a4a3a;
}

.demo-instructions p {
    color: #4a4a3a;
    line-height: 1.6;
    margin-bottom: 10px;
}

.demo-instructions ul {
    margin-left: 20px;
    color: #4a4a3a;
}

.demo-instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Анимации для подсказок */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hints-panel {
    animation: slideInFromTop 0.5s ease;
}

.hint-item {
    animation: slideInFromTop 0.3s ease;
}

/* Стили для кнопки переключения подсказок */
#toggle-hints {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 10px;
    font-size: 0.9em;
}

#toggle-hints:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Стили для демо-модального окна */
#demo-instructions-modal .modal-content {
    max-width: 600px;
}

#demo-instructions-content {
    line-height: 1.6;
    color: #6b5d4f;
}

#demo-instructions-content h4 {
    color: #6b5d4f;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

#demo-instructions-content h4 i {
    color: #b8a895;
}

#demo-instructions-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

#demo-instructions-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Адаптивность для подсказок */
@media (max-width: 768px) {
    .hints-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .hints-content {
        padding: 15px;
    }
    
    .hint-item {
        padding: 12px;
    }
    
    .hint-title {
        font-size: 1em;
    }
}

/* Стили для генерации дел */
.generation-info {
    background: #f0f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.generation-info h4 {
    color: #4a4a3a;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.generation-info ul {
    margin-left: 20px;
    color: #4a4a3a;
}

.generation-info li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.generated-case-item {
    background: #f5f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.generated-case-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.generated-case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d4c4b0;
}

.generated-case-title {
    font-weight: 600;
    color: #4a4a3a;
    font-size: 1.1em;
}

.generated-case-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.generated-case-meta span {
    background: #d4c4b0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #4a4a3a;
}

.generated-case-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875em;
}

.btn-outline-primary {
    background: transparent;
    color: #a88999;
    border: 1px solid #a88999;
}

.btn-outline-primary:hover {
    background: #a88999;
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

/* Стили для модального окна генерации */
#generate-case-modal .modal-content {
    max-width: 600px;
}

#generated-cases-modal .modal-content {
    max-width: 800px;
}

.generated-cases-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Анимации для генерации */
@keyframes generatePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.generating {
    animation: generatePulse 1s infinite;
}

/* Стили для чекбокса */
.form-group label input[type="checkbox"] {
    margin-right: 8px;
}

/* Прогресс-бар генерации */
.generation-progress-container {
    margin-top: 20px;
    padding: 20px;
    background: #f0f0e8;
    border-radius: 8px;
    border: 1px solid #d4c4b0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#progress-status-text {
    font-weight: 600;
    color: #4a4a3a;
    font-size: 0.95em;
}

#progress-percentage {
    font-weight: 700;
    color: #a88999;
    font-size: 1.1em;
}

.progress-bar-wrapper {
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #d4c4b0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a88999 0%, #987889 50%, #a88999 100%);
    background-size: 200% 100%;
    border-radius: 12px;
    transition: width 0.3s ease;
    animation: progress-shimmer 2s infinite;
    box-shadow: 0 2px 4px rgba(168, 137, 153, 0.3);
}

@keyframes progress-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-steps {
    margin-top: 15px;
}

.progress-step {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 0;
    font-size: 0.9em;
    color: #4a4a3a;
    transition: color 0.3s ease;
}

.progress-step.active {
    color: #a88999;
    font-weight: 600;
}

.progress-step.completed {
    color: #6b5d4f;
    font-weight: 600;
}

.progress-step-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
}

.progress-step.active .progress-step-icon {
    color: #a88999;
}

.progress-step.completed .progress-step-icon {
    color: #6b5d4f;
}

.step-detail {
    width: 100%;
    flex-basis: 100%;
    margin-top: 4px;
    margin-left: 24px;
    font-size: 0.9em;
    color: #666;
}

/* Адаптивность для генерации */
@media (max-width: 768px) {
    .generated-case-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .generated-case-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .generated-case-actions {
        flex-direction: column;
    }
    
    #generate-case-modal .modal-content,
    #generated-cases-modal .modal-content {
        max-width: 95%;
    }
    
    .generation-progress-container {
        padding: 15px;
    }
}

/* Стили для документов дела */
.documents-list {
    max-height: 500px;
    overflow-y: auto;
}

.document-item {
    background: #f0f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.document-item.has-errors {
    border-left: 4px solid #c9a9a9;
    background: #f5ebe8;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d4c4b0;
}

.document-header h4 {
    margin: 0;
    color: #4a4a3a;
    font-size: 1.1em;
}

.document-date {
    color: #4a4a3a;
    font-size: 0.9em;
}

.document-errors {
    background: #f5ebe8;
    color: #4a4a3a;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.document-content {
    background: #f5f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 4px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.document-content pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    color: #4a4a3a;
}

/* Двухколоночный макет для игровой области */
.game-layout {
    display: flex;
    gap: 20px;
    margin: 0; /* Убираем все отступы */
    padding: 0; /* Убираем внутренние отступы */
    min-height: 600px;
    width: 100%; /* Занимаем всю ширину */
    max-width: 100%; /* Ограничиваем максимальную ширину, чтобы не было прокрутки */
    box-sizing: border-box; /* Учитываем padding и border в ширине */
    overflow-x: hidden; /* Скрываем горизонтальную прокрутку */
}

.case-info-panel {
    /* Увеличена ширина до максимум 30% (было 15-20%) - панель подстраивается под размер окна */
    flex: 0 0 30% !important; /* 30% от ширины контейнера (максимум) */
    min-width: 300px !important; /* Минимальная ширина для читаемости */
    max-width: 500px !important; /* Максимальная ширина */
    background: #f5f0e8;
    border-radius: 0; /* Убираем скругление углов */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #d4c4b0;
    overflow: hidden;
    margin: 0; /* Убираем отступы */
    box-sizing: border-box; /* Учитываем padding и border в ширине */
}

/* Стили для left-sidebar в court_session.html - переопределяют inline стили */
.left-sidebar {
    /* Увеличена ширина до максимум 30% (было фиксированные 390px = ~15-20%) */
    width: auto !important; /* Убираем фиксированную ширину */
    flex: 0 0 30% !important; /* 30% от ширины контейнера (максимум) */
    min-width: 300px !important; /* Минимальная ширина для читаемости */
    max-width: 500px !important; /* Максимальная ширина */
    box-sizing: border-box !important; /* Учитываем padding и border в ширине */
}

/* Контейнер main-content в court_session.html - обеспечивает flexbox layout */
.main-content {
    display: flex !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important; /* Предотвращаем горизонтальную прокрутку */
    min-width: 0 !important; /* Позволяем контейнеру сжиматься */
}

/* Убеждаемся, что все дочерние элементы могут сжиматься */
.main-content > * {
    min-width: 0 !important; /* Позволяем всем дочерним элементам сжиматься */
}

/* Правый блок step-content в court_session.html - занимает оставшееся пространство */
.step-content {
    flex: 1 1 auto !important; /* Занимает оставшееся пространство, может сжиматься */
    min-width: 0 !important; /* Убираем минимальную ширину, чтобы блок мог сжиматься */
    max-width: 100% !important; /* Ограничиваем максимальную ширину */
    width: 100% !important; /* Занимает доступную ширину */
    box-sizing: border-box !important;
    overflow-x: hidden !important; /* Скрываем горизонтальную прокрутку внутри блока */
}

.hearing-panel {
    /* Занимает оставшееся пространство - автоматически уменьшается при увеличении левого блока */
    flex: 1; /* Занимает оставшееся пространство (70% и более) */
    min-width: 300px; /* Минимальная ширина для читаемости */
    background: #f5f0e8;
    border-radius: 0; /* Убираем скругление углов */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #d4c4b0;
    overflow: visible; /* Изменено с hidden на visible, чтобы блоки управления были видны */
    display: flex;
    flex-direction: column;
    margin: 0; /* Убираем отступы */
    box-sizing: border-box; /* Учитываем padding и border в ширине */
}

.panel-header {
    background: #e8d4c4;
    padding: 15px 20px;
    border-bottom: 1px solid #d4c4b0;
    margin: 0;
}

.panel-header h4 {
    margin: 0;
    color: #4a4a3a;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h4 i {
    color: #4a4a3a;
}

.info-section {
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h5 {
    color: #4a4a3a;
    font-size: 1.1em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.info-section h5 i {
    color: #4a4a3a;
    font-size: 0.9em;
}

.info-content {
    background: #f0f0e8;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #b8a895;
    font-size: 0.95em;
    line-height: 1.5;
    color: #4a4a3a;
    max-height: 200px;
    overflow-y: auto;
}

.info-content:empty::before {
    content: "Информация будет загружена при выборе дела";
    color: #4a4a3a;
    font-style: italic;
}

/* Стили для документов в левой панели */
.case-documents-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.case-documents-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f5f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 4px;
    font-size: 0.9em;
    color: #4a4a3a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.case-documents-list li:hover {
    background: #e8f0e8;
    border-color: #b8d4b8;
}

.case-documents-list li.has-errors {
    border-left: 3px solid #c9a9a9;
    background: #f5ebe8;
}

.case-documents-list li.has-errors:hover {
    background: #f0e0d8;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .game-layout {
        flex-direction: column;
    }
    
    .case-info-panel {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        margin-bottom: 20px;
    }
    
    .hearing-panel {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
    }
    
    /* На мобильных устройствах блоки управления располагаются вертикально */
    .error-and-controls-container {
        flex-direction: column !important;
    }
    
    .error-detection-section,
    .error-detection-enhanced {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .step-controls {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
    }
}

/* Дополнительная адаптивность для средних экранов */
@media (min-width: 1025px) and (max-width: 1400px) {
    .case-info-panel {
        flex: 0 0 30% !important; /* Оставляем 30% на средних экранах */
        max-width: 450px !important; /* Немного уменьшаем максимальную ширину */
    }
    
    .hearing-panel {
        flex: 1 !important; /* Занимает оставшееся пространство */
    }
}

@media (max-width: 768px) {
    .game-layout {
        gap: 15px;
    }
    
    .info-section {
        padding: 15px;
    }
    
    .panel-header {
        padding: 12px 15px;
    }
}

/* Стили для навигационного меню */
.main-nav {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    padding: 15px 30px;
    border-top: 1px solid #d4c4b0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f0f0e8;
    color: #4a4a3a;
    text-decoration: none;
    border-radius: 25px;
    border: 2px solid #d4c4b0;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9em;
}

.nav-link:hover {
    background: #a88999;
    color: white;
    border-color: #a88999;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 137, 153, 0.3);
}

.nav-link i {
    font-size: 1.1em;
}

/* Адаптивность для навигации */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
        padding: 15px 20px;
    }
    
    .nav-link {
        flex: 1 1 auto;
        min-width: 120px;
        justify-content: center;
    }
}

/* Система вкладок */
/* Разделы контента */
.content-section {
    display: block;
}

.content-section.hidden {
    display: none;
}

.content-section.active {
    display: block;
}

/* Старые стили вкладок (удалены) */
.tabs-container {
    margin-bottom: 20px;
    border-bottom: 2px solid #d4c4b0;
}

.tabs {
    display: flex;
    gap: 10px;
    padding: 0 20px;
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #4a4a3a;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button:hover {
    color: #4a4a3a;
    background: #f0f0e8;
}

.tab-button.active {
    color: #a88999;
    border-bottom-color: #a88999;
    font-weight: 600;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Чат Техно-юрист */
.tech-lawyer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Панель аутентификации */
.auth-panel {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background: #f5f0e8;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.auth-panel h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #4a4a3a;
}

.auth-panel > p {
    text-align: center;
    color: #4a4a3a;
    margin-bottom: 30px;
}

.auth-form {
    margin-top: 20px;
}

.auth-form h3 {
    margin-bottom: 20px;
    color: #4a4a3a;
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    color: #4a4a3a;
}

.auth-switch a {
    color: #a88999;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.error-message {
    margin-top: 15px;
    padding: 10px;
    background: #f5ebe8;
    color: #4a4a3a;
    border-radius: 4px;
    border: 1px solid #c9a9a9;
}

.error-message.hidden {
    display: none;
}

/* Панель чата */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 600px;
    background: #f5f0e8;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chat-header {
    padding: 15px 20px;
    background: #a88999;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d4c4b0;
}

.chat-header h3 {
    margin: 0;
    color: #ffffff;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f0f0e8;
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    background: #a88999;
    color: #ffffff;
    margin-left: auto;
    text-align: right;
}

.ai-message {
    background: #f5f0e8;
    color: #4a4a3a;
    border: 1px solid #d4c4b0;
}

.chat-message.loading {
    opacity: 0.7;
    font-style: italic;
}

/* Анимация вращающейся иконки робота */
.loading-robot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.robot-spinning {
    animation: spin-robot 2s linear infinite;
    font-size: 1.5em;
    color: #a88999;
}

@keyframes spin-robot {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(270deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.message-time {
    opacity: 0.7;
    font-size: 0.85em;
}

.message-content {
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Уменьшаем высоту <br> для компактности */
.message-content br {
    line-height: 0.5;
    display: block;
    margin: 0;
    height: 0.5em;
}

/* Скрываем множественные <br> подряд - оставляем максимум два */
.message-content br + br + br {
    display: none;
}

/* Стили для абзацев и заголовков в сообщениях AI - убираем лишние отступы */
.message-content p {
    margin-top: 0;
    margin-bottom: 4px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin-top: 6px;
    margin-bottom: 3px;
    font-weight: 600;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child,
.message-content h4:first-child,
.message-content h5:first-child,
.message-content h6:first-child {
    margin-top: 0;
}

/* Стили для списков в сообщениях AI - увеличиваем отступы слева */
.message-content ul,
.message-content ol {
    margin-left: 25px;
    padding-left: 15px;
    margin-top: 1px;
    margin-bottom: 1px;
}

.message-content li {
    margin-bottom: 1px;
    line-height: 1.6;
}

/* Убираем отступы для первого и последнего элементов */
.message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
}

/* Стили для других элементов в сообщениях AI */
.message-content pre {
    margin-top: 4px;
    margin-bottom: 4px;
    padding: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow-x: auto;
}

.message-content code {
    padding: 2px 4px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-content blockquote {
    margin-top: 4px;
    margin-bottom: 4px;
    margin-left: 15px;
    padding-left: 10px;
    border-left: 3px solid #d4c4b0;
    color: #6b5d4f;
}

/* Релевантные статьи */
.chat-articles {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px 20px;
    background: #f5f0e8;
    border-top: 1px solid #d4c4b0;
}

.chat-articles.hidden {
    display: none;
}

.chat-articles h4 {
    margin-bottom: 15px;
    color: #4a4a3a;
    font-size: 1.1em;
}

.article-item {
    padding: 12px;
    margin-bottom: 10px;
    background: #f0f0e8;
    border-left: 4px solid #b8a895;
    border-radius: 4px;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.article-header strong {
    color: #a88999;
}

.article-meta {
    font-size: 0.85em;
    color: #4a4a3a;
}

.article-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a4a3a;
}

.article-preview {
    font-size: 0.9em;
    color: #4a4a3a;
    line-height: 1.4;
}

/* Область ввода чата */
.chat-input-area {
    padding: 15px 20px;
    background: #f5f0e8;
    border-top: 1px solid #d4c4b0;
}

.chat-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.chat-actions .btn {
    flex: 1;
}

/* Адаптивность для чата */
@media (max-width: 768px) {
    .chat-panel {
        height: calc(100vh - 150px);
        min-height: 400px;
        padding: 5px;
    }
    
    .chat-message {
        max-width: 95%;
        padding: 8px 12px;
        margin-bottom: 8px;
    }
    
    .chat-messages {
        padding: 5px;
        margin-bottom: 5px;
        max-height: calc(100vh - 300px);
    }
    
    .chat-input-area {
        padding: 8px;
    }
    
    .chat-articles {
        max-height: 150px;
        padding: 8px;
    }
    
    .tech-lawyer-container {
        padding: 5px;
        max-width: 100%;
    }
    
    .auth-panel {
        padding: 10px;
        margin: 20px auto;
        max-width: 100%;
    }
    
    .auth-form {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .chat-header {
        padding: 10px;
    }
    
    .tabs {
        flex-direction: column;
        padding: 0 5px;
    }
    
    .tab-button {
        width: 100%;
        justify-content: center;
        padding: 10px;
        margin-bottom: 5px;
    }
    
    /* Уменьшение отступов для всех блоков */
    .module-card,
    .card,
    .panel {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

/* Стили для правой панели дела - убираем фиксированную высоту и ширину */
.step-content {
    /* Убираем фиксированную минимальную высоту - контейнер растягивается по содержимому */
    min-height: auto !important;
    /* Адаптивная ширина - подстраивается под размер окна, может сжиматься */
    flex: 1 1 auto !important; /* Может сжиматься и расширяться */
    min-width: 0 !important; /* Убираем минимальную ширину для возможности сжатия */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important; /* Скрываем горизонтальную прокрутку */
}

/* Контейнер для реплик - убираем прокрутку, чтобы блоки управления были сразу после реплик */
.step-items-container {
    /* Убираем flex: 1 и overflow-y: auto - контейнер растягивается по содержимому */
    flex: none !important;
    overflow: visible !important;
    /* Убираем фиксированную высоту */
    max-height: none !important;
    /* Убираем ограничения по ширине для возможности сжатия */
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Контейнер для блока обнаружения ошибок и управления - должен быть сразу после реплик */
.error-and-controls-container {
    margin-top: 20px;
    /* Убираем любые ограничения по высоте */
    flex: none !important;
    /* Убираем фиксированные пропорции - блоки подстраиваются под ширину окна */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Блок обнаружения ошибок - адаптивная ширина */
.error-detection-section,
.error-detection-enhanced {
    /* Убираем фиксированную ширину 66.666% - блок подстраивается под размер окна */
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Кнопки управления - адаптивная ширина */
.step-controls {
    /* Убираем фиксированную ширину 33.333% - блок подстраивается под размер окна */
    flex: 0 0 auto !important;
    min-width: 200px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Реплики (step-item) - адаптивная ширина */
.step-item {
    /* Убираем любые ограничения по ширине - реплики подстраиваются под размер окна */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Стили для вкладок редактора дел */
.nav-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid #d4c4b0;
    margin-bottom: 20px;
}

.nav-tabs .nav-item {
    margin-right: 5px;
}

.nav-tabs .nav-link {
    display: block;
    padding: 10px 20px;
    background: #f5f0e8;
    color: #4a4a3a;
    text-decoration: none;
    border: 1px solid #d4c4b0;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    background: #e8e0d0;
    color: #4a4a3a;
}

.nav-tabs .nav-link.active {
    background: #a88999;
    color: white;
    border-color: #a88999;
    font-weight: bold;
}

.tab-pane {
    display: none;
    padding: 20px;
    background: #fff;
    border: 1px solid #d4c4b0;
    border-radius: 0 5px 5px 5px;
}

.tab-pane.active {
    display: block;
}

/* Стили для редактора реплик */
.replica-editor-item {
    margin-bottom: 15px;
}

.replica-editor-item .form-group {
    margin-bottom: 10px;
}

.step-editor {
    margin-bottom: 20px;
}

.step-editor h4 {
    color: #6b5d4f;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #d4c4b0;
}

/* Стили для редактора документов */
.document-editor-item {
    margin-bottom: 20px;
}

.document-editor-item h4 {
    color: #6b5d4f;
    margin-bottom: 15px;
}