/* Базовые стили для приложения Tests с поддержкой темной темы */
.tests-header {
    background: var(--light-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.tests-header h1 {
    margin: 0 0 20px 0;
    color: var(--text-color);
}

.tests-nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--light-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background: var(--primary-color-dark, #0056b3);
    color: var(--light-color);
    text-decoration: none;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.9em;
}

.btn:hover {
    color: var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--light-color);
}

.btn-primary:hover {
    background: var(--primary-color-dark, #0056b3);
    color: var(--light-color);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn.active, .difficulty-btn.active, .topic-btn.active, .all-questions-btn.active, .time-limit-btn.active {
    background: var(--primary-color);
    color: var(--light-color);
    border-color: var(--primary-color);
}

.difficulty-btn, .topic-btn, .all-questions-btn, .time-limit-btn {
    min-width: 90px;
    margin: 2px 4px 2px 0;
    font-weight: 600;
    border-width: 2px;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    outline: none;
}

.difficulty-btn:hover,
.difficulty-btn:focus,
.topic-btn:hover,
.topic-btn:focus,
.all-questions-btn:hover,
.all-questions-btn:focus,
.time-limit-btn:hover,
.time-limit-btn:focus {
    z-index: 9999;
    position: relative;
}

/* Tooltip для кнопок */
.difficulty-btn[data-tooltip]:hover:after,
.topic-btn[data-tooltip]:hover:after,
.all-questions-btn[data-tooltip]:hover:after,
.time-limit-btn[data-tooltip]:hover:after {
    content: attr(data-tooltip);
    position: fixed;
    left: 50%;
    top: 110%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 0.92em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.93;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-top: 4px;
    filter: brightness(1.1) saturate(1.1);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 10000;
}

.difficulty-btn.active, .topic-btn.active, .all-questions-btn.active, .time-limit-btn.active {
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* Адаптивность */
@media (max-width: 768px) {
    .tests-nav {
        flex-direction: column;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.test-card,
.category-card {
    animation: fadeIn 0.6s ease-out;
}

/* --- Стили для страницы test_start --- */
.test-start-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin: 0 auto;
    max-width: 1200px;
    padding: 30px 0;
}

.test-start-form {
    flex: 1 1 350px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 32px 28px;
    min-width: 320px;
    max-width: 420px;
}

.test-start-form h3 {
    margin-top: 0;
    color: var(--text-color);
}

.form-section {
    margin-bottom: 28px;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.95em;
    margin-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-color);
}

.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 4px;
    display: inline-block;
    margin-right: 6px;
    background: var(--card-bg);
}

.test-info {
    flex: 2 1 400px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 32px 28px;
    min-width: 320px;
}

.test-info h3 {
    margin-top: 0;
    color: var(--text-color);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 18px;
}

.info-card {
    background: var(--light-color);
    border-radius: 10px;
    box-shadow: 0 1px 6px var(--shadow-color);
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .test-start-container {
        flex-direction: column;
        gap: 24px;
    }
    .test-info, .test-start-form {
        max-width: 100%;
        min-width: 0;
    }
} 

/* --- Стили для страницы статистики пользователя --- */
.statistics-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 0;
}

.overall-stats {
    margin-bottom: 36px;
}

.topic-stats-section {
    margin-bottom: 36px;
}

.topic-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.topic-stat-card {
    background: var(--light-color);
    border-radius: 10px;
    box-shadow: 0 1px 6px var(--shadow-color);
    padding: 20px 16px;
}

.topic-header h3 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.topic-stats {
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.test-card,
.category-card {
    animation: fadeIn 0.6s ease-out;
} 

.difficulty-badge, .type-badge {
    font-size: 0.92em;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--light-color);
    color: var(--primary-color);
    font-weight: 500;
}
.type-badge {
    background: var(--light-color);
    color: var(--secondary-color, #7b3fe4);
}

/* --- Стили для таймера теста --- */
.test-timer {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary-color);
    background: var(--light-color);
    border-radius: 6px;
    padding: 6px 18px;
    margin-left: 10px;
    letter-spacing: 1px;
    box-shadow: 0 1px 6px var(--shadow-color);
    display: inline-block;
    min-width: 70px;
    text-align: center;
    transition: background 0.5s, color 0.5s;
}
.test-timer.time-expired {
    color: var(--danger-color, #c82333);
    background: #ffeaea;
    animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
    to { opacity: 0.4; }
}
.timer-label {
    font-size: 1em;
    color: var(--text-muted);
    margin-right: 8px;
}

/* --- Интерактивный прогресс-бар теста --- */
.progress-bar {
    display: flex;
    height: 18px;
    cursor: pointer;
    user-select: none;
    width: 100%;
    background: var(--border-color, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
}
.progress-segment {
    flex: 1 1 0;
    min-width: 2px;
    height: 100%;
    transition: flex-basis 0.18s, height 0.18s, z-index 0.18s, box-shadow 0.18s;
    z-index: 1;
    outline: none;
    position: relative;
}
.progress-segment-empty {
    background: #e0e0e0;
}
.progress-segment-correct {
    background: #4caf50;
}
.progress-segment-wrong {
    background: #f44336;
}
.progress-segment:hover, .progress-segment:focus {
    flex-basis: 3em;
    height: 28px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(33,150,243,0.18);
    outline: 2px solid #2196f3;
}
.progress-segment.current {
    border-top: 3px solid #2196f3;
    box-shadow: 0 2px 8px #2196f3;
}
@media (max-width: 600px) {
    .progress-bar {
        height: 12px;
    }
    .progress-segment:hover, .progress-segment:focus {
        height: 18px;
    }
}