/* tests/css/tests.css */
:root {
    /* Радиусы скругления */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Базовые стили */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    line-height: 1.5;
}

.container {
    max-width: 100%;
    padding: 0 15px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.refresh-button {
    background: none;
    border: none;
    color: var(--tg-theme-button-color);
    width: 32px;
    height: 32px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-button svg {
    width: 24px;
    height: 24px;
}

/* Список тестов */
.tests-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.test-item {
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.test-item:active {
    transform: translateY(2px);
    box-shadow: var(--shadow-sm);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.test-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.test-badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.test-badge.available {
    background: #4CAF50;
    color: white;
}

.test-badge.completed {
    background: #2196F3;
    color: white;
}

.test-badge.cooldown {
    background: #FFC107;
    color: var(--tg-theme-text-color, #333);
}

.test-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.test-description {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #8e8e93);
    margin: 0 0 10px 0;
}

.test-info-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
}

.test-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.test-stat-icon {
    opacity: 0.7;
}

.test-progress-bar {
    height: 6px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.test-progress-bar .progress {
    height: 100%;
    background: var(--tg-theme-button-color, #3390ec);
    border-radius: 3px;
}

/* Лоадер */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--tg-theme-hint-color, #8e8e93);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-wrapper {
    background: var(--tg-theme-bg-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

/* Для телефонов выводим на полный экран */
@media (max-width: 768px) {
    .modal-wrapper {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}

.modal-header {
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f0f2f5);
    padding-bottom: 5px;
    margin-bottom: 0px;
}

.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.test-timer {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.test-timer svg {
    width: 16px;
    height: 16px;
}

.test-progress {
    font-weight: 500;
}

.modal-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid var(--tg-theme-secondary-bg-color, #f0f2f5);
    padding-top: 15px;
}

/* Кнопки */
.primary-button,
.secondary-button {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-button {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, white);
    flex: 1;
}

.secondary-button {
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    color: var(--tg-theme-text-color);
}

.primary-button:hover,
.secondary-button:hover {
    opacity: 0.9;
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

/* Вопросы */
.question-container {
    padding: 10px 0;
}

.question {
    margin-bottom: 15px;
}

.question:last-child {
    margin-bottom: 0;
}

.question-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

.question-media {
    margin-bottom: 15px;
    text-align: center;
}

.question-media img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.question-media video {
    max-width: 300px;
    border-radius: var(--radius-sm);
}

/* Варианты ответов */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Опции для обычных вопросов */
.option-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    cursor: pointer;
    transition: background 0.2s;
}

.option-item:hover {
    background: var(--tg-theme-secondary-bg-color, #e1e5eb);
}

.option-item.selected {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, white);
}

.option-item input[type="checkbox"],
.option-item input[type="radio"] {
    margin-right: 10px;
}

/* Опции для вопросов с порядком */
.order-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 20px 15px;
    border-radius: var(--radius-sm);
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    cursor: grab;
    user-select: none;
}

.order-item:active {
    cursor: grabbing;
}

.order-handle {
    margin-right: 10px;
    opacity: 0.5;
}

/* Опции для вопросов с сопоставлением */
.match-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.match-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    cursor: pointer;
    transition: background 0.2s;
}

.match-item.selected {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, white);
}

.match-line {
    position: absolute;
    background: var(--tg-theme-button-color, #3390ec);
    height: 2px;
    pointer-events: none;
    z-index: 1;
}

/* Модальное окно с результатами */
.result-modal {
    max-width: 450px;
}

.result-container {
    text-align: center;
    padding: 20px 0;
}

.result-status {
    margin-bottom: 20px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.result-icon.success::before {
    content: "🎉";
}

.result-icon.failure::before {
    content: "😞";
}

.result-message {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border-radius: var(--radius-md);
}

.score-label {
    font-weight: 500;
}

.score-value {
    font-weight: 600;
    color: var(--tg-theme-button-color, #3390ec);
}

.result-rewards {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.reward {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.reward-icon {
    font-size: 24px;
}

.reward-value {
    font-weight: 500;
}

/* Скроллбар */
.modal-content::-webkit-scrollbar {
    width: 5px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border-radius: 5px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--tg-theme-hint-color, #8e8e93);
    border-radius: 5px;
	overflow-y:visible;
}

/* Утилиты */
.hidden {
    display: none !important;
}
/* Стили для раздела специальных тестов */
.section-subtitle {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 15px 0;
    color: var(--tg-theme-text-color);
}

.special-tests {
    margin-bottom: 25px;
}

.special-tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.special-test-card {
    display: flex;
    align-items: center;
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border-radius: var(--radius-md);
    padding: 10px;
    text-decoration: none;
    color: var(--tg-theme-text-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.special-test-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.special-test-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.test-icon {
    font-size: 28px;
    margin-right: 15px;
}

.test-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.test-info p {
   margin-left:30px;
    font-size: 12px;
    color: var(--tg-theme-hint-color, #8e8e93);
}
/* Стили для кнопок перемещения элементов в порядке */
.order-item {
    position: relative;
}

.move-buttons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.move-button {
    width: 28px;
    height: 28px;
    background-color: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tg-theme-text-color);
    font-size: 14px;
    transition: all 0.2s ease;
}

.move-button:hover {
    background-color: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, white);
}

.move-button:active {
    transform: scale(0.9);
}

.move-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.order-text {
    padding-right: 70px; /* Чтобы текст не перекрывался с кнопками */
}
.test-badge.fully_completed {
    background: #4CAF50;
    color: white;
}
.reward-reduced {
    color: var(--tg-theme-hint-color, #8e8e93);
    text-decoration: line-through;
    font-size: 80%;
}
/* Стили для раздела неправильных ответов */
.wrong-answers-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--tg-theme-secondary-bg-color, #f0f2f5);
    display: none; /* Скрываем по умолчанию */
}

.wrong-answers-container h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.wrong-answers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wrong-answer-item {
    background: var(--tg-theme-secondary-bg-color, #f0f2f5);
    border-radius: var(--radius-sm);
    padding: 15px;
}

.wrong-question-text {
    font-weight: 500;
    margin-bottom: 10px;
}

.wrong-answer-detail {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wrong-answer-text, .correct-answer-text {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.wrong-answer-text {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.correct-answer-text {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.answer-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.7;
    margin-bottom: -3px;
}
/* Стили для контейнера с изображением в неправильных ответах */
.wrong-answer-media {
    margin: 10px 0;
    text-align: center;
}

.wrong-answer-media img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Стили для видео в разделе работы над ошибками */
.wrong-answer-media .video-container {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin: 15px 0;
    transition: all 0.3s ease;
}

.wrong-answer-media .video-container:hover .play-button {
    transform: translate(-50%, -50%) scale(1.1);
}

.wrong-answer-media .play-button {
    transition: transform 0.2s ease;
}

.wrong-answer-media video {
    border-radius: 8px;
    background-color: #000;
}
/* Стили для тестов травмированных пользователей */
.injury-tests-section {
    margin-bottom: 25px;
}

.injury-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 15px 0;
    color: var(--tg-theme-text-color, #333);
}

.injury-section-title small {
    font-size: 12px;
    font-weight: normal;
    color: var(--tg-theme-hint-color, #8e8e93);
    display: block;
    margin-top: 5px;
}

.injury-tests-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.test-item.injury-test {
    background: linear-gradient(
  135deg,
  var(--tg-theme-bg-color) 0%,
  var(--tg-theme-secondary-bg-color) 100%
);
    border: 1px solid #0ea5e9;
}

.injury-reward-note {
    font-size: 10px;
    color: #0ea5e9;
    font-weight: 600;
}

.section-divider {
    border: none;
    border-top: 2px solid var(--tg-theme-secondary-bg-color, #f0f2f5);
    margin: 25px 0;
}

.tests-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}