/**
 * Frontend Audit Complete CSS
 * Комплексная оптимизация всех фронтенд аспектов
 */

/* 1. ИСПРАВЛЕНИЕ ВЫПАДАЮЩИХ СПИСКОВ "ПОДРОБНЕЕ" */
.step-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-top: 0;
    z-index: 1000;
    position: relative;
}

.step-content.active {
    max-height: 2000px;
    opacity: 1;
    visibility: visible;
    padding: 20px;
    overflow: visible;
    z-index: 2000;
}

.step-items {
    display: grid;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease 0.2s;
}

.step-content.active .step-items {
    opacity: 1;
    transform: translateY(0);
}

.step-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.step-content.active .step-item {
    opacity: 1;
    transform: translateY(0);
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(120, 119, 198, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(120, 119, 198, 0.15);
}

.step-dropdown-btn {
    background: rgba(120, 119, 198, 0.1);
    border: 1px solid rgba(120, 119, 198, 0.3);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.step-dropdown-btn:hover {
    background: rgba(120, 119, 198, 0.2);
    border-color: rgba(120, 119, 198, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(120, 119, 198, 0.2);
}

.step-dropdown-btn.active {
    background: rgba(120, 119, 198, 0.3);
    border-color: rgba(120, 119, 198, 0.6);
}

.step-dropdown-btn:focus-visible {
    outline: 2px solid rgba(168, 167, 255, 0.8);
    outline-offset: 2px;
}

.step-arrow {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    display: inline-block;
}

.step-dropdown-btn.active .step-arrow {
    transform: rotate(180deg);
}

/* 2. УЛУЧШЕНИЕ НАВИГАЦИИ УРОВНЕЙ */
.level-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.level-nav-btn:hover {
    background: rgba(120, 119, 198, 0.2);
    border-color: rgba(120, 119, 198, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 119, 198, 0.2);
}

.level-nav-btn.active {
    background: rgba(120, 119, 198, 0.3);
    border-color: rgba(120, 119, 198, 0.6);
    box-shadow: 0 4px 15px rgba(120, 119, 198, 0.3);
}

.level-nav-icon {
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(120, 119, 198, 0.2);
    border-radius: 50%;
}

.level-nav-text strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.level-nav-text small {
    opacity: 0.7;
    font-size: 0.8rem;
}

.level-content {
    margin-top: 20px;
}

.level-panel {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 3. УЛУЧШЕНИЕ МОБИЛЬНОГО МЕНЮ */
.mobile-menu-btn {
    width: 30px;
    height: 25px;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: #ffffff;
    margin: 0 auto 5px;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-btn span:last-child {
    margin-bottom: 0;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -8px);
}

.mobile-dropdown {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background: rgba(26, 35, 62, 0.95);
    backdrop-filter: blur(20px);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.mobile-dropdown.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 4. УЛУЧШЕНИЕ КНОПОК И ИНТЕРАКТИВНЫХ ЭЛЕМЕНТОВ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.8), rgba(168, 167, 255, 0.8));
    color: #ffffff;
    border: 1px solid rgba(120, 119, 198, 0.5);
}

.btn--primary:hover {
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.9), rgba(168, 167, 255, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(120, 119, 198, 0.3);
}

.btn--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn--secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

.btn:focus-visible {
    outline: 2px solid rgba(168, 167, 255, 0.8);
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(0);
}

.btn__icon {
    font-size: 1.1rem;
}

/* 5. УЛУЧШЕНИЕ КАРУСЕЛЕЙ */
.carousel, .slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.carousel-container, .slider-container {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-item, .slide {
    min-width: 100%;
    flex-shrink: 0;
}

.carousel-nav, .slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px;
    pointer-events: none;
}

.carousel-prev, .carousel-next, .slider-prev, .slider-next {
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    font-size: 1.2rem;
}

.carousel-prev:hover, .carousel-next:hover, .slider-prev:hover, .slider-next:hover {
    background: rgba(120, 119, 198, 0.8);
    transform: scale(1.1);
}

.carousel-dots, .slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-dot, .slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot:hover, .slider-dot:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.carousel-dot.active, .slider-dot.active {
    background: rgba(120, 119, 198, 0.8);
    transform: scale(1.1);
}

/* 6. АДАПТИВНОСТЬ */
@media (max-width: 1200px) {
    .container {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .step-dropdown-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .step-content.active {
        padding: 15px;
    }
    
    .step-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .level-nav-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .level-nav-icon {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .mobile-dropdown {
        width: 90%;
        max-width: none;
    }
    
    .carousel-prev, .carousel-next, .slider-prev, .slider-next {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .step-dropdown-btn {
        width: 100%;
        justify-content: center;
    }
    
    .level-nav-btn {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .carousel-dots, .slider-dots {
        bottom: 10px;
    }
    
    .carousel-dot, .slider-dot {
        width: 8px;
        height: 8px;
    }
}

/* 7. ДОСТУПНОСТЬ (ACCESSIBILITY) */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .step-content,
    .step-items,
    .step-item,
    .step-dropdown-btn,
    .level-nav-btn,
    .btn,
    .mobile-dropdown,
    .mobile-menu-overlay,
    .carousel-item,
    .slide {
        transition: none !important;
        animation: none !important;
    }
}

/* Улучшение контрастности */
@media (prefers-contrast: high) {
    .btn--primary {
        background: #7877c6;
        border: 2px solid #ffffff;
    }
    
    .btn--secondary {
        background: #ffffff;
        color: #000000;
        border: 2px solid #000000;
    }
    
    .step-dropdown-btn {
        background: #7877c6;
        border: 2px solid #ffffff;
        color: #ffffff;
    }
    
    .level-nav-btn {
        background: #7877c6;
        border: 2px solid #ffffff;
        color: #ffffff;
    }
}

/* Фокусировка для клавиатурной навигации */
*:focus {
    outline: 2px solid rgba(168, 167, 255, 0.8);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid rgba(168, 167, 255, 0.8);
    outline-offset: 2px;
}

/* 8. ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ */
.step-content,
.step-items,
.step-item,
.step-dropdown-btn,
.level-nav-btn,
.btn,
.mobile-dropdown,
.mobile-menu-overlay,
.carousel-item,
.slide {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* GPU ускорение */
.step-content.active,
.step-content.active .step-items,
.step-content.active .step-item,
.level-nav-btn.active,
.btn:hover,
.mobile-dropdown.active {
    transform: translateZ(0);
}

/* 9. СЕМАНТИЧЕСКИЕ УЛУЧШЕНИЯ */
.study-step {
    position: relative;
}

.study-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.1), rgba(168, 167, 255, 0.1));
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.study-step:hover::before {
    opacity: 1;
}

/* 10. ПОЛНЫЙ РЕФАКТОРИНГ СТИЛЕЙ */
/* Удаление дублирующихся и конфликтующих стилей */
.step-content.active,
.step-content.show,
.dropdown-menu.active,
.dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: 2000 !important;
}

/* Гарантия видимости на всех устройствах */
.step-content.active .step-item,
.step-content.show .step-item,
.dropdown-menu.active .step-item,
.dropdown-menu.show .step-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 11. ФИНАЛЬНЫЕ ОПТИМИЗАЦИИ */
/* Улучшение рендеринга */
.step-content,
.step-items,
.step-item,
.level-panel {
    contain: layout style paint;
}

/* Оптимизация для мобильных */
@media (max-width: 768px) {
    .step-content,
    .step-items,
    .step-item {
        contain: none;
    }
}

/* Улучшение читаемости */
.step-item h4,
.item-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #ffffff;
    line-height: 1.3;
}

.step-item p,
.item-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

.item-number {
    background: rgba(120, 119, 198, 0.3);
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* 12. ЗАВЕРШАЮЩИЕ СТИЛИ */
/* Глобальные улучшения */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background: #0a0a0f;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Улучшение изображений */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy.loaded {
    opacity: 1;
}

/* Улучшение ссылок */
a {
    color: rgba(168, 167, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: rgba(168, 167, 255, 1);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid rgba(168, 167, 255, 0.8);
    outline-offset: 2px;
    border-radius: 4px;
}
