/* ENHANCED MOBILE STYLES FOR CIAQ PROJECT */
/* Решение всех проблем с мобильной адаптацией */

/* ===========================================
   УЛУЧШЕННЫЕ БАЗОВЫЕ СТИЛИ ДЛЯ МОБИЛЬНЫХ
   =========================================== */

/* Улучшенный viewport для мобильных устройств */
@media (max-width: 768px) {
    
    /* =====================================
       ГЛОБАЛЬНЫЕ УЛУЧШЕНИЯ
       ===================================== */
    
    * {
        -webkit-tap-highlight-color: rgba(36, 156, 255, 0.2);
        touch-action: manipulation;
    }
    
    body {
        font-size: 16px; /* Базовый размер для мобильных */
        line-height: 1.5;
        overflow-x: hidden;
        scroll-behavior: smooth;
    }
    
    /* =====================================
       УЛУЧШЕННЫЙ МОБИЛЬНЫЙ ХЕДЕР
       ===================================== */
    
    .header {
        height: 65px; /* Немного уменьшили для мобильных */
        padding: 0 1rem;
        position: sticky;
        top: 0;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
        display: grid;
        grid-template-columns: auto 1fr auto auto;
        gap: 0.75rem;
        align-items: center;
    }
    
    /* Мобильная кнопка меню - больше и заметнее */
    .mobile-menu-btn {
        display: flex;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.75rem;
        margin: -0.75rem -0.5rem -0.75rem -0.75rem;
        border-radius: 12px;
        transition: all 0.3s ease;
        color: var(--dark);
        z-index: 1002;
    }
    
    .mobile-menu-btn:hover,
    .mobile-menu-btn:active {
        background-color: rgba(36, 156, 255, 0.1);
        transform: scale(1.05);
    }
    
    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
        stroke-width: 2.5;
    }
    
    /* Улучшенная поисковая строка для мобильных */
    .search-bar {
        background-color: #f8f9fa;
        border-radius: 25px;
        padding: 0.65rem 1rem;
        width: 100%;
        max-width: none; /* Убираем ограничение */
        min-width: 0;
        border: 2px solid transparent;
        transition: all 0.3s ease;
        position: relative;
    }
    
    .search-bar:focus-within {
        border-color: var(--primary);
        background-color: white;
        box-shadow: 0 4px 12px rgba(36, 156, 255, 0.15);
        transform: translateY(-1px);
    }
    
    .search-bar input {
        border: none;
        background: none;
        outline: none;
        width: 100%;
        padding: 0.25rem 0.5rem;
        font-size: 16px; /* Предотвращает зум на iOS */
        color: var(--dark);
    }
    
    .search-bar input::placeholder {
        color: #999;
        font-size: 15px;
    }
    
    .search-bar svg {
        color: #666;
        transition: color 0.3s ease;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }
    
    .search-bar:focus-within svg {
        color: var(--primary);
    }
    
    /* Улучшенные кнопки действий в хедере */
    .action-btn {
        background-color: var(--primary);
        color: white;
        border: none;
        border-radius: 12px;
        padding: 0.75rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        transition: all 0.3s ease;
        min-width: 44px; /* Минимальный размер для сенсорного ввода */
        min-height: 44px;
        position: relative;
        box-shadow: 0 2px 8px rgba(36, 156, 255, 0.2);
    }
    
    .action-btn:hover,
    .action-btn:active {
        background-color: #1d7dd8;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(36, 156, 255, 0.3);
    }
    
    .action-btn span {
        display: none; /* Скрываем текст, оставляем только иконку */
    }
    
    .action-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* Улучшенная кнопка уведомлений */
    .notify-btn {
        background: #f8f9fa;
        border: 2px solid transparent;
        cursor: pointer;
        color: var(--dark);
        border-radius: 12px;
        padding: 0.75rem;
        position: relative;
        transition: all 0.3s ease;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .notify-btn:hover,
    .notify-btn:active {
        background-color: rgba(36, 156, 255, 0.1);
        border-color: rgba(36, 156, 255, 0.2);
        transform: translateY(-1px);
    }
    
    .notify-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .notify-badge {
        position: absolute;
        top: 8px;
        right: 8px;
        background-color: var(--secondary);
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        box-shadow: 0 2px 6px rgba(240, 54, 110, 0.3);
    }
    
    /* Компактные элементы управления справа */
    .header-controls {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Улучшенный переключатель языка */
    .lang-switch {
        display: flex;
        align-items: center;
        cursor: pointer;
        background: #f8f9fa;
        border-radius: 10px;
        padding: 0.5rem 0.75rem;
        transition: all 0.3s ease;
        min-height: 44px;
    }
    
    .lang-switch:hover,
    .lang-switch:active {
        background-color: rgba(36, 156, 255, 0.1);
        transform: translateY(-1px);
    }
    
    .lang-switch svg {
        width: 18px;
        height: 18px;
    }
    
    .lang-text {
        font-size: 0.85rem;
        font-weight: 600;
        margin-left: 0.4rem;
        color: var(--dark);
    }
    
    /* Улучшенная кнопка пользователя */
    .user-btn {
        background-color: var(--primary);
        color: white;
        border: none;
        border-radius: 12px;
        padding: 0.65rem 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        font-weight: 600;
        font-size: 0.85rem;
        min-height: 44px;
        box-shadow: 0 2px 8px rgba(36, 156, 255, 0.2);
    }
    
    .user-btn:hover,
    .user-btn:active {
        background-color: #1d7dd8;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(36, 156, 255, 0.3);
    }
    
    .user-btn svg {
        width: 18px;
        height: 18px;
        margin-right: 0.5rem;
    }
    
    /* =====================================
       УЛУЧШЕННОЕ МОБИЛЬНОЕ МЕНЮ
       ===================================== */
    
    .sidebar {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
        backdrop-filter: blur(20px);
        width: 320px; /* Немного шире для лучшего восприятия */
        min-height: 100vh;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
        transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 1100;
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        border-right: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay для закрытия меню */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        z-index: 1099;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Улучшенный заголовок сайдбара */
    .sidebar-header {
        display: flex;
        align-items: center;
        padding: 1rem 1.5rem 2rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        position: relative;
    }
    
    .logo {
        font-size: 1.5rem;
        font-weight: bold;
        color: var(--primary);
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
    }
    
    .logo img {
        height: 50px;
        width: auto;
    }
    
    /* Кнопка закрытия меню */
    .sidebar-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(0, 0, 0, 0.05);
        border: none;
        cursor: pointer;
        color: var(--dark);
        border-radius: 8px;
        padding: 0.5rem;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-close:hover,
    .sidebar-close:active {
        background: rgba(0, 0, 0, 0.1);
        transform: scale(1.1);
    }
    
    .sidebar-close svg {
        width: 20px;
        height: 20px;
    }
    
    /* Улучшенные элементы меню */
    .menu {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0 1rem;
    }
    
    .menu-item {
        display: flex;
        align-items: center;
        padding: 1rem 1.25rem;
        margin: 0.25rem 0;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        text-decoration: none;
        color: var(--dark);
        position: relative;
        overflow: hidden;
        font-weight: 500;
        min-height: 56px; /* Увеличенная высота для сенсорного ввода */
    }
    
    .menu-item::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(36, 156, 255, 0.1), transparent);
        transition: left 0.6s;
    }
    
    .menu-item:hover::before,
    .menu-item:active::before {
        left: 100%;
    }
    
    .menu-item:hover,
    .menu-item:active {
        background: linear-gradient(135deg, rgba(36, 156, 255, 0.08) 0%, rgba(36, 156, 255, 0.04) 100%);
        color: var(--primary);
        transform: translateX(4px);
        box-shadow: 0 4px 12px rgba(36, 156, 255, 0.1);
    }
    
    .menu-item.active {
        background: linear-gradient(135deg, var(--primary) 0%, #1d7dd8 100%);
        color: white;
        box-shadow: 0 6px 20px rgba(36, 156, 255, 0.3);
    }
    
    .menu-item.active::before {
        display: none;
    }
    
    .menu-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 1rem;
        flex-shrink: 0;
    }
    
    .menu-text {
        font-size: 1rem;
        line-height: 1.4;
        flex: 1;
    }
    
    /* Футер сайдбара */
    .sidebar-footer {
        padding: 1.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        margin-top: 1rem;
    }
    
    /* =====================================
       ОСНОВНОЙ КОНТЕНТ
       ===================================== */
    
    .main-content {
        margin-left: 0;
        width: 100%;
        transition: none;
        position: relative;
        min-height: 100vh;
    }
    
    .main-content.menu-open {
        overflow: hidden;
    }
    
    /* =====================================
       УЛУЧШЕННЫЕ СЕКЦИИ КОНТЕНТА
       ===================================== */
    
    .section {
        padding: 2rem 1rem;
    }
    
    /* Улучшенная hero секция */
    .hero-section {
        background-image: url("./assets/hero.png");
        background-size: cover;
        background-position: center;
        padding: 3rem 1.5rem;
        text-align: center;
        position: relative;
        border-radius: 0 0 24px 24px;
        overflow: hidden;
    }
    
    .hero-section::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        opacity: 0.6;
        z-index: 1;
    }
    
    .hero-title {
        font-size: 2.2rem;
        margin-bottom: 1.5rem;
        font-weight: bold;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        max-width: 90%;
        margin: 0 auto 2rem;
        line-height: 1.6;
    }
    
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary {
        font-size: 1rem;
        padding: 1rem 2rem;
        border-radius: 12px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.3s ease;
        width: 100%;
        max-width: 280px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 52px;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-primary:active,
    .btn-secondary:active {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }
    
    /* =====================================
       УЛУЧШЕННЫЕ КАРТОЧКИ ПРОЕКТОВ
       ===================================== */
    
    .projects-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 1.5rem;
        padding: 0;
    }
    
    .project-card {
        background-color: white;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
        transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        position: relative;
        border: 1px solid rgba(0, 0, 0, 0.04);
    }
    
    .project-card:hover,
    .project-card:active {
        transform: translateY(-6px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
        border-color: rgba(36, 156, 255, 0.2);
    }
    
    .project-img-gallery {
        height: 200px;
        position: relative;
        overflow: hidden;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    }
    
    .project-content-enhanced {
        padding: 1.5rem;
        position: relative;
    }
    
    .project-title-enhanced {
        font-size: 1.2rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        color: var(--dark);
        line-height: 1.3;
    }
    
    .project-desc-enhanced {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
        color: #666;
    }
    
    .project-more-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1.5rem;
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 600;
        color: white;
        text-decoration: none;
        background: linear-gradient(135deg, var(--primary) 0%, #1d7dd8 100%);
        transition: all 0.3s ease;
        box-shadow: 0 3px 12px rgba(36, 156, 255, 0.2);
        min-height: 44px;
        justify-content: center;
        width: 100%;
    }
    
    .project-more-btn:hover,
    .project-more-btn:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(36, 156, 255, 0.3);
    }
    
    .event-link-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1.5rem;
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 600;
        color: white;
        text-decoration: none;
        background: linear-gradient(135deg, var(--primary) 0%, #1d7dd8 100%);
        transition: all 0.3s ease;
        box-shadow: 0 3px 12px rgba(36, 156, 255, 0.2);
        min-height: 44px;
        justify-content: center;
        width: 100%;
    }
    
    .event-link-btn:hover,
    .event-link-btn:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(36, 156, 255, 0.3);
    }
    
    /* =====================================
       УЛУЧШЕННЫЕ ФИЛЬТРЫ
       ===================================== */
    
    .filters {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }
    
    .filter-select {
        padding: 1rem;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        background-color: white;
        font-size: 1rem;
        width: 100%;
        transition: all 0.3s ease;
        min-height: 52px;
    }
    
    .filter-select:focus {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(36, 156, 255, 0.15);
        outline: none;
    }
    
    /* =====================================
       УЛУЧШЕННАЯ ТИПОГРАФИКА
       ===================================== */
    
    .section-title {
        font-size: 1.75rem;
        font-weight: bold;
        color: var(--dark);
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    /* =====================================
       АНИМАЦИИ И ПЕРЕХОДЫ
       ===================================== */
    
    @keyframes slideInFromLeft {
        from {
            opacity: 0;
            transform: translateX(-30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .menu-item {
        animation: slideInFromLeft 0.3s ease forwards;
    }
    
    .menu-item:nth-child(1) { animation-delay: 0.1s; }
    .menu-item:nth-child(2) { animation-delay: 0.15s; }
    .menu-item:nth-child(3) { animation-delay: 0.2s; }
    .menu-item:nth-child(4) { animation-delay: 0.25s; }
    .menu-item:nth-child(5) { animation-delay: 0.3s; }
    
    .project-card {
        animation: fadeInUp 0.4s ease forwards;
    }
    
    .project-card:nth-child(1) { animation-delay: 0.1s; }
    .project-card:nth-child(2) { animation-delay: 0.2s; }
    .project-card:nth-child(3) { animation-delay: 0.3s; }
    
    /* =====================================
       СПЕЦИАЛЬНЫЕ МОБИЛЬНЫЕ УТИЛИТЫ
       ===================================== */
    
    /* Скрытие элементов на мобильных */
    .hide-mobile {
        display: none !important;
    }
    
    /* Показывание только на мобильных */
    .show-mobile {
        display: block !important;
    }
    
    /* Улучшенная доступность */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    
    /* Тактильная обратная связь */
    .tactile-feedback:active {
        transform: scale(0.98);
    }
    
    /* =====================================
       УЛУЧШЕННЫЕ СОСТОЯНИЯ ЗАГРУЗКИ
       ===================================== */
    
    .loading {
        min-height: 200px;
        text-align: center;
    }
    
    .loading-icon {
        width: 50px;
        height: 50px;
        margin: 0 auto;
    }
}

/* =====================================
   ДОПОЛНИТЕЛЬНЫЕ МЕДИАЗАПРОСЫ
   ===================================== */

/* Для очень маленьких экранов (до 480px) */
@media (max-width: 480px) {
    .header {
        padding: 0 0.75rem;
        grid-template-columns: auto 1fr auto;
        gap: 0.5rem;
    }
    
    .search-bar {
        font-size: 15px;
        padding: 0.6rem 0.9rem;
    }
    
    .hero-title {
        font-size: 1.9rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section {
        padding: 1.5rem 0.75rem;
    }
    
    .sidebar {
        width: 90vw;
        max-width: 320px;
    }
    
    .project-card {
        margin: 0 0.25rem;
    }
    
    /* Упрощенная строка заголовка на маленьких экранах */
    .header-controls {
        gap: 0.25rem;
    }
    
    .lang-switch .lang-text {
        display: none;
    }
    
    .user-btn span {
        display: none;
    }
    
    .user-btn {
        padding: 0.75rem;
        min-width: 44px;
    }
}

/* Для планшетов в портретной ориентации */
@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 0;
    }
    
    .header {
        padding: 0 1.5rem;
    }
    
    .search-bar {
        max-width: 60%;
    }
}

/* =====================================
   ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ
   ===================================== */

/* Улучшенный фокус для клавиатурной навигации */
@media (max-width: 768px) {
    .menu-item:focus,
    .action-btn:focus,
    .project-more-btn:focus,
    .filter-select:focus,
    .search-bar input:focus {
        outline: 3px solid rgba(36, 156, 255, 0.3);
        outline-offset: 2px;
    }
    
    /* Уменьшенные анимации для пользователей с предпочтением сниженного движения */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Тёмная тема для мобильных устройств */
    @media (prefers-color-scheme: dark) {
        .sidebar {
            background: linear-gradient(135deg, rgba(30, 30, 30, 0.98) 0%, rgba(45, 45, 45, 0.98) 100%);
            color: #e9ecef;
        }
        
        .menu-item {
            color: #e9ecef;
        }
        
        .menu-item:hover {
            background: rgba(36, 156, 255, 0.2);
        }
        
        .project-card {
            background-color: #2d3748;
            color: #e9ecef;
            border-color: rgba(255, 255, 255, 0.1);
        }
        
        .filter-select {
            background-color: #2d3748;
            color: #e9ecef;
            border-color: rgba(255, 255, 255, 0.2);
        }
        
        .search-bar {
            background-color: rgba(45, 55, 72, 0.6);
            color: #e9ecef;
        }
        
        .search-bar input {
            color: #e9ecef;
        }
        
        .search-bar input::placeholder {
            color: #a0aec0;
        }
    }
} 