/* Стили для тренажера Python задач */

/* Переключатель режимов */
.mode-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-switcher__btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.mode-switcher__btn:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-color-hover);
}

.mode-switcher__btn--active {
    background: var(--color-blue);
    color: var(--color-white);
    border-color: var(--color-blue);
}

.mode-switcher__btn--active:hover {
    background: var(--color-light-blue);
    border-color: var(--color-light-blue);
}

/* Фильтры */
.filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.filter-select {
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--border-color-hover);
    background: var(--bg-input-focus);
}

/* Мета-информация задачи */
.task-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.task-meta__badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.task-meta__badge--topic {
    background: rgba(74, 111, 165, 0.15);
    color: var(--color-blue);
}

.task-meta__badge--difficulty {
    background: rgba(212, 165, 116, 0.2);
    color: var(--color-orange);
}

.task-meta__badge--attempts {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.task-meta__badge--new {
    background: rgba(33, 150, 243, 0.15);
    color: #2196f3;
    font-weight: 600;
}

.task-meta__badge--category {
    background: rgba(156, 39, 176, 0.15);
    color: #9c27b0;
}

[data-theme="dark"] .task-meta__badge--topic {
    background: rgba(107, 157, 217, 0.2);
    color: var(--color-light-blue);
}

[data-theme="dark"] .task-meta__badge--difficulty {
    background: rgba(232, 184, 138, 0.2);
    color: var(--color-orange);
}

[data-theme="dark"] .task-meta__badge--attempts {
    background: rgba(76, 175, 80, 0.25);
    color: #66bb6a;
}

[data-theme="dark"] .task-meta__badge--new {
    background: rgba(33, 150, 243, 0.25);
    color: #64b5f6;
}

/* Карточка задачи в режиме просмотра */
.task-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-card);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.task-description-preview {
    margin: 12px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Контейнер обучения */
.task-learning-container {
    max-width: 100%;
}

.task-learning-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .task-learning-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.task-learning-card__header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.task-learning-card__header h2 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.task-learning-card__description {
    margin-bottom: 24px;
}

.task-learning-card__description h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.task-description-text {
    background: var(--bg-input);
    padding: 16px;
    border-radius: 4px;
    border-left: 4px solid var(--color-blue);
    line-height: 1.5;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Уменьшаем интервалы в описании задачи */
.task-description-text p {
    margin: 0.5em 0;
}

.task-description-text p:first-child {
    margin-top: 0;
}

.task-description-text p:last-child {
    margin-bottom: 0;
}

.task-description-text h2,
.task-description-text h3,
.task-description-text h4 {
    margin: 1em 0 0.5em 0;
    line-height: 1.3;
}

.task-description-text h2:first-child,
.task-description-text h3:first-child,
.task-description-text h4:first-child {
    margin-top: 0;
}

/* Уменьшаем интервалы в списках */
.task-description-text ul,
.task-description-text ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.task-description-text li {
    margin: 0.25em 0;
    line-height: 1.4;
}

.task-description-text ul ul,
.task-description-text ol ol,
.task-description-text ul ol,
.task-description-text ol ul {
    margin: 0.25em 0;
}

/* Уменьшаем интервалы для блоков кода */
.task-description-text pre {
    margin: 0.5em 0;
}

.task-description-text code {
    line-height: 1.4;
}

/* Обертка для поля ввода кода и подсказки */
.task-learning-card__code-hint-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 24px;
}

@media (min-width: 992px) {
    .task-learning-card__code-hint-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .task-learning-card__code-input,
    .task-learning-card__hint {
        flex: 1;
        min-width: 0;
    }
}

.task-learning-card__code-input {
    margin-bottom: 0;
}

.task-learning-card__code-input h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.code-editor {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.code-editor:focus {
    outline: none;
    border-color: var(--color-blue);
    background: var(--bg-input-focus);
}

/* Подсказка */
.task-learning-card__hint {
    margin-bottom: 0;
}

.hint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hint-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.hint-output {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.hint-output pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.hint-output code {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Действия */
.task-learning-card__actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* Результат проверки */
.check-feedback {
    margin-top: 24px;
    padding: 20px;
    border-radius: 4px;
    background: var(--bg-input);
    border-left: 4px solid var(--color-blue);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.check-feedback h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.check-feedback__content {
    line-height: 1.8;
    color: var(--text-primary);
}

.check-feedback--correct {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4caf50;
}

[data-theme="dark"] .check-feedback--correct {
    background: rgba(76, 175, 80, 0.2);
}

.check-feedback--incorrect {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: #f44336;
}

[data-theme="dark"] .check-feedback--incorrect {
    background: rgba(244, 67, 54, 0.2);
}

.task-learning-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Список задач в режиме обучения */
.tasks-list-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.tasks-list-mini {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.task-list-item {
    display: block;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    background: var(--bg-input);
}

.task-list-item:hover {
    background: var(--bg-input-focus);
    border-color: var(--color-blue);
    text-decoration: none;
    color: var(--text-primary);
}

.task-list-item--active {
    background: rgba(74, 111, 165, 0.15);
    border-color: var(--color-blue);
    border-width: 2px;
}

[data-theme="dark"] .task-list-item--active {
    background: rgba(107, 157, 217, 0.2);
}

.task-list-item__header {
    margin-bottom: 8px;
}

.task-list-item__header strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.task-list-item__preview {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .task-learning-card {
        padding: 16px;
    }
    
    .task-learning-card__actions {
        flex-direction: column;
    }
    
    .task-learning-card__actions .btn {
        width: 100%;
    }
}

