/* ============================================================================
   КРИТИЧЕСКИЙ CSS ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   Оптимизация для устранения forced reflow и улучшения производительности
   ============================================================================ */

/* Критический CSS для мобильных устройств (max-width: 768px) */
@media (max-width: 768px) {
    /* ============================================================================
       БАЗОВЫЕ СТИЛИ - КРИТИЧЕСКИЕ
       ============================================================================ */
    
    /* Предотвращение forced reflow */
    * {
        box-sizing: border-box !important;
    }
    
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body {
        font-size: 16px !important;
        line-height: 1.5 !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    /* ============================================================================
       НАВИГАЦИЯ - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    /* Унификация навигации для всех языковых версий */
    .navbar {
        padding: 0.5rem 1rem !important;
        min-height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        position: relative !important;
        z-index: 1000 !important;
    }
    
    .navbar .container {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 0 !important;
        flex-wrap: nowrap !important;
        max-width: 100% !important;
    }
    
    /* Логотип - фиксированная ширина */
    .navbar-brand {
        display: flex !important;
        align-items: center !important;
        margin-right: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        max-width: 60% !important;
        overflow: hidden !important;
        text-decoration: none !important;
    }
    
    .navbar-brand img {
        height: 32px !important;
        width: auto !important;
        flex-shrink: 0 !important;
        display: block !important;
    }
    
    .navbar-brand span,
    .navbar-brand {
        font-size: 14px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 200px !important;
        color: inherit !important;
    }
    
    /* Сэндвич-меню - всегда справа */
    .navbar-toggler {
        order: 3 !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        padding: 0.5rem !important;
        min-height: 44px !important;
        min-width: 44px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 8px !important;
        background-color: #f8f9fa !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        cursor: pointer !important;
        transition: none !important;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
        outline: none !important;
    }
    
    .navbar-toggler-icon {
        width: 20px !important;
        height: 2px !important;
        background-color: #6c757d !important;
        position: relative !important;
        display: block !important;
    }
    
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        content: '' !important;
        position: absolute !important;
        width: 20px !important;
        height: 2px !important;
        background-color: #6c757d !important;
        left: 0 !important;
    }
    
    .navbar-toggler-icon::before {
        top: -6px !important;
    }
    
    .navbar-toggler-icon::after {
        bottom: -6px !important;
    }
    
    /* Скрываем навигационные элементы на мобильных */
    .navbar-collapse {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        border-top: 1px solid #dee2e6 !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        z-index: 1000 !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        display: none !important;
    }
    
    .navbar-collapse.show {
        display: block !important;
    }
    
    /* Принудительное расположение элементов */
    .navbar > .container > * {
        flex-shrink: 0 !important;
    }
    
    .navbar > .container > .navbar-brand {
        flex: 1 1 auto !important;
        margin-right: 1rem !important;
    }
    
    .navbar > .container > .navbar-toggler {
        flex: 0 0 auto !important;
        margin-left: 0 !important;
    }
    
    /* Предотвращение переноса элементов */
    .navbar .container {
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }
    
    /* ============================================================================
       HERO SECTION - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    .hero-section {
        min-height: 400px !important;
        padding: 2rem 0 !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
        margin: 0 0 1rem 0 !important;
        font-weight: 700 !important;
    }
    
    .hero-description {
        font-size: 1.1rem !important;
        line-height: 1.5 !important;
        margin: 0 0 1.5rem 0 !important;
    }
    
    .hero-image {
        min-height: 300px !important;
        margin-top: 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .hero-chat-demo {
        max-width: 100% !important;
        min-height: 280px !important;
        margin: 0 10px !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
        overflow: hidden !important;
    }
    
    /* Обеспечиваем горизонтальное расположение точек в мобильной версии */
    .hero-chat-demo .window-controls,
    .hero-chat-demo .d-flex.window-controls,
    .hero-chat-demo .window-controls.d-flex,
    .hero-section .hero-chat-demo .window-controls,
    .hero-section .hero-chat-demo .d-flex.window-controls,
    .hero-section .hero-chat-demo .window-controls.d-flex {
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: center !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        padding: 8px 12px !important;
    }
    
    .hero-chat-demo .window-controls .dot,
    .hero-chat-demo .dot,
    .hero-chat-demo .window-controls .bg-danger,
    .hero-chat-demo .window-controls .bg-warning,
    .hero-chat-demo .window-controls .bg-success {
        width: 8px !important;
        height: 8px !important;
        margin-right: 4px !important;
        display: inline-block !important;
        flex-shrink: 0 !important;
        border-radius: 50% !important;
    }
    
    .hero-chat-demo .window-controls .dot:last-child,
    .hero-chat-demo .dot:last-child,
    .hero-chat-demo .window-controls .bg-success {
        margin-right: 8px !important;
    }
    
    /* Улучшаем отображение заголовка чата в мобильной версии */
    .hero-chat-demo .chat-header {
        padding: 8px 0 !important;
        border-bottom: 1px solid #e9ecef !important;
        background: #f8f9fa !important;
    }
    
    .hero-chat-demo .chat-header .text-muted {
        font-size: 12px !important;
        font-weight: 500 !important;
        color: #6c757d !important;
    }
    
    .hero-btn {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        text-align: center !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
        padding: 12px 16px !important;
        border-radius: 8px !important;
        margin-bottom: 8px !important;
        display: inline-block !important;
        text-decoration: none !important;
        border: none !important;
        cursor: pointer !important;
        transition: none !important;
    }
    
    .hero-btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .hero-section .d-flex {
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    .hero-section .d-flex .btn {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
    
    /* ============================================================================
       КОНТЕЙНЕРЫ И СЕТКА - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }
    
    .row {
        display: flex !important;
        flex-wrap: wrap !important;
        margin: 0 -8px !important;
    }
    
    .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
        padding: 0 8px !important;
        box-sizing: border-box !important;
    }
    
    .col-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .col-lg-7 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .col-lg-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* ============================================================================
       ТИПОГРАФИЯ - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    h1, h2, h3, h4, h5, h6 {
        margin: 0 0 1rem 0 !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
    }
    
    h1 {
        font-size: 2.5rem !important;
    }
    
    h2 {
        font-size: 2rem !important;
    }
    
    h3 {
        font-size: 1.75rem !important;
    }
    
    p {
        margin: 0 0 1rem 0 !important;
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    .lead {
        font-size: 1.1rem !important;
        line-height: 1.5 !important;
    }
    
    /* ============================================================================
       КНОПКИ И ИНТЕРАКТИВНЫЕ ЭЛЕМЕНТЫ - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    .btn {
        display: inline-block !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        text-align: center !important;
        text-decoration: none !important;
        border: none !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        min-height: 44px !important;
        transition: none !important;
        box-sizing: border-box !important;
    }
    
    .btn-primary {
        background-color: #3b82f6 !important;
        color: white !important;
    }
    
    .btn-outline-primary {
        background-color: transparent !important;
        color: #3b82f6 !important;
        border: 1px solid #3b82f6 !important;
    }
    
    /* ============================================================================
       УТИЛИТЫ - КРИТИЧЕСКИЕ СТИЛИ
       ============================================================================ */
    
    .d-flex {
        display: flex !important;
    }
    
    .align-items-center {
        align-items: center !important;
    }
    
    .justify-content-center {
        justify-content: center !important;
    }
    
    .text-center {
        text-align: center !important;
    }
    
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 3rem !important;
    }
    
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .bg-white {
        background-color: white !important;
    }
    
    .shadow-sm {
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }
    
    /* ============================================================================
       ПРЕДОТВРАЩЕНИЕ FORCED REFLOW
       ============================================================================ */
    
    /* Отключаем transitions для критических элементов */
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
    
    /* Предотвращение layout thrashing */
    .container, .row, .col, .navbar, .hero-section {
        will-change: auto !important;
        transform: none !important;
    }
    
    /* Оптимизация для GPU */
    .navbar, .hero-section, .hero-chat-demo {
        transform: translateZ(0) !important;
        backface-visibility: hidden !important;
    }
} 