/**
 * Стили для страницы подтем в mini-app
 * 
 * Этот файл содержит все стили для отображения подтем с уровнями сложности
 * и прогресс-барами в матричной теме.
 * 
 * @author Mini App Team
 * @version 1.0.0
 */

/* CSS переменные для единообразия с главной страницей */
:root {
    --base-bg: #151F28;
    --matrix-color: #00ff00;
    --active-color: #29fd53;
}

/* Заголовок страницы с кнопкой "Назад" и названием темы */
.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 0, 0.1);
    color: var(--active-color);
    border: 1px solid rgba(0, 255, 0, 0.4);
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
    flex-shrink: 0;
}

.back-button:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.6);
    transform: translateX(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
}

.back-button:active {
    transform: translateX(0);
}

.back-button i {
    font-size: 16px;
}

.back-button span {
    font-weight: 500;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--active-color);
    flex-grow: 1;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
}

/* Основной контейнер */
.topic-detail-container {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Заголовок темы */
.topic-header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.4);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.topic-header h1 {
    color: var(--active-color);
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.topic-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

/* Сетка подтем */
.subtopics-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 20px !important;
}

/* Карточка подтемы */
.subtopic-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.4);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-align: center;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.subtopic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(0, 255, 0, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.subtopic-card h3 {
    color: var(--active-color);
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Статистика подтемы */
.subtopic-stats {
    margin-bottom: 20px;
}

.questions-count {
    background: rgba(0, 255, 0, 0.1);
    color: var(--active-color);
    border: 1px solid rgba(0, 255, 0, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Полосы сложности */
.difficulty-bars {
    margin-top: 20px;
    display: grid;
    gap: 16px;
}

.diff-row {
    display: grid;
    grid-template-columns: 70px 1fr 30px;
    align-items: center;
    gap: 10px;
}

.diff-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    text-align: left;
    font-weight: 600;
    text-transform: capitalize;
}

.diff-bar {
    position: relative;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(0, 255, 0, 0.5);
    border-radius: 16px;
    overflow: visible;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

/* Иконка для кликабельности */
.diff-bar::after {
    content: '▶';
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--active-color);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.subtopic-card .diff-bar {
    pointer-events: auto;
}

.diff-bar:hover {
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--active-color);
    background: rgba(0, 255, 0, 0.15);
    transform: translateX(2px);
    border-width: 2px;
}

.diff-bar:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
}

.diff-bar:active {
    transform: scale(0.985) translateX(2px);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.5), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.diff-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 14px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
}

.diff-solved {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 14px;
    transition: width 0.4s ease;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.diff-solved.easy {
    background: linear-gradient(90deg, #16a34a, #22c55e, #16a34a);
    background-size: 200% 100%;
    animation: pulse-glow 2s ease-in-out infinite, gradient-shift 3s ease infinite;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.diff-solved.medium {
    background: linear-gradient(90deg, #d97706, #f59e0b, #d97706);
    background-size: 200% 100%;
    animation: pulse-glow 2s ease-in-out infinite, gradient-shift 3s ease infinite;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.diff-solved.hard {
    background: linear-gradient(90deg, #dc2626, #ef4444, #dc2626);
    background-size: 200% 100%;
    animation: pulse-glow 2s ease-in-out infinite, gradient-shift 3s ease infinite;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.diff-solved.all {
    background: linear-gradient(90deg, #2563eb, #3b82f6, #2563eb);
    background-size: 200% 100%;
    animation: pulse-glow 2s ease-in-out infinite, gradient-shift 3s ease infinite;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.diff-bar.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.2);
}

.diff-bar.disabled::after {
    content: '🔒';
    opacity: 0.3;
}

.diff-bar.disabled:hover,
.diff-bar.disabled:active {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
}

.diff-bar.disabled:hover::after {
    opacity: 0.3;
    transform: translateY(-50%);
    text-shadow: none;
}

.diff-text {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
}

/* Сообщение об отсутствии подтем */
.no-subtopics {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(0, 255, 0, 0.4);
    border-radius: 15px;
    padding: 60px 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.no-subtopics-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.no-subtopics h3 {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    font-size: 20px;
}

.no-subtopics p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    margin: 0;
}

/* Адаптивность для разных размеров экрана */
@media (max-width: 1200px) {
    .subtopics-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
        gap: 18px !important;
    }
}

@media (max-width: 768px) {
    .topic-detail-container {
        padding: 15px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .subtopics-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
        gap: 15px !important;
    }
    
    .subtopic-card {
        padding: 20px;
    }
    
    .topic-header {
        padding: 20px;
    }
    
    .topic-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .page-header {
        gap: 10px;
    }
    
    .page-header h1 {
        font-size: 18px;
    }
    
    .back-button {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .subtopics-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .subtopic-card {
        padding: 15px;
    }
    
    .diff-row {
        grid-template-columns: 60px 1fr 25px;
        gap: 8px;
    }
    
    .diff-bar {
        height: 28px;
    }
    
    .diff-bar::after {
        right: -22px;
        font-size: 12px;
    }
    
    .diff-text {
        font-size: 12px;
        right: 30px;
    }
}
