/* ═══════════════════════════════════════════════════════════════════════
   МОБИЛЬНАЯ ВЕРСИЯ v2.0 — ИСПРАВЛЕННАЯ
   ═══════════════════════════════════════════════════════════════════════ */

/* Базовые стили для мобильных */
@media (max-width: 768px) {
    /* Убираем горизонтальный скролл */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* HEADER — фиксированный, не перекрывает контент */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 2px 20px rgba(0,0,0,0.1);
        padding: 10px 0;
    }
    
    .header-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 15px;
    }
    
    /* Логотип — компактный */
    .logo {
        order: 1;
        flex: 0 0 auto;
    }
    
    .logo img {
        height: 45px !important;
        width: auto;
        max-width: 120px;
        object-fit: contain;
    }
    
    /* Переключатель лиг — компактный */
    .league-switcher {
        order: 2;
        display: flex;
        gap: 8px;
        flex: 0 0 auto;
    }
    
    .league-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 6px;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .league-logo {
        height: 18px !important;
        width: auto;
    }
    
    /* Скрываем десктопное меню */
    .main-nav {
        display: none !important;
        order: 99;
    }
    
    /* Скрываем десктопные кнопки */
    .header-actions {
        display: none !important;
        order: 98;
    }
    
    /* Гамбургер меню */
    .mobile-menu-toggle {
        display: flex !important;
        order: 3;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        width: 40px;
        height: 40px;
        justify-content: center;
        align-items: center;
    }
    
    .mobile-menu-toggle span {
        width: 25px;
        height: 3px;
        background: var(--secondary);
        border-radius: 3px;
        transition: all 0.3s;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* МОБИЛЬНОЕ МЕНЮ */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        box-shadow: -10px 0 40px rgba(0,0,0,0.2);
        z-index: 999;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-menu.active {
        right: 0;
    }
    
    .mobile-menu-header {
        background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
        color: white;
        padding: 25px 20px;
        position: relative;
    }
    
    .mobile-menu-logo {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .mobile-menu-logo img {
        height: 50px;
        width: auto;
        border-radius: 8px;
    }
    
    .mobile-menu-logo span {
        font-size: 1.2rem;
        font-weight: 700;
    }
    
    .mobile-menu-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(255,255,255,0.2);
        border: none;
        color: white;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 1.8rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s;
    }
    
    .mobile-menu-close:hover {
        background: rgba(255,255,255,0.3);
        transform: rotate(90deg);
    }
    
    .mobile-menu-content {
        padding: 20px 0;
    }
    
    .mobile-league-switcher {
        display: flex;
        gap: 10px;
        padding: 0 20px 20px;
        background: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
    }
    
    .mobile-league-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px;
        border-radius: 10px;
        text-decoration: none;
        font-weight: 600;
        color: #666;
        background: white;
        border: 2px solid #e9ecef;
        transition: all 0.3s;
    }
    
    .mobile-league-btn.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
    }
    
    .mobile-league-logo {
        height: 24px;
        width: auto;
    }
    
    .mobile-nav {
        padding: 10px 0;
    }
    
    .mobile-nav-link {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 16px 20px;
        color: var(--dark);
        text-decoration: none;
        font-weight: 500;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.3s;
    }
    
    .mobile-nav-link:hover,
    .mobile-nav-link.active {
        background: rgba(230, 57, 70, 0.08);
        color: var(--primary);
        padding-left: 25px;
    }
    
    .mobile-nav-icon {
        font-size: 1.3rem;
        width: 30px;
        text-align: center;
    }
    
    .social-icon-small {
        width: 24px;
        height: 24px;
        border-radius: 4px;
    }
    
    .mobile-nav-divider {
        height: 1px;
        background: linear-gradient(90deg, transparent, #e9ecef, transparent);
        margin: 15px 0;
    }
    
    /* Overlay */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .mobile-menu-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* HERO SECTION */
    .hero-section {
        padding: 40px 15px;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        padding: 12px;
    }
    
    .hero-image {
        display: none;
    }
    
    /* MAIN CONTENT */
    .main-content {
        padding: 20px 0;
    }
    
    .container {
        padding: 0 10px;
    }
    
    /* Grid layout */
    .main-grid {
        display: block !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .sidebar {
        position: relative !important;
        top: 0 !important;
        width: 100% !important;
    }
    
    .mini-standings,
    .top-players,
    .calendar-section,
    .news-section {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    /* КАЛЕНДАРЬ */
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        font-size: 0.75rem;
        gap: 4px;
    }
    
    .calendar-day-header {
        padding: 8px 2px;
        font-size: 0.7rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }
    
    .calendar-day-number {
        font-size: 0.8rem;
    }
    
    .match-item {
        font-size: 0.7rem;
        padding: 4px;
        margin: 2px 0;
    }
    
    .team-logo {
        width: 16px;
        height: 16px;
    }
    
    /* ТАБЛИЦЫ */
    .standings-table,
    .data-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    /* НОВОСТИ */
    .news-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* FOOTER */
    .site-footer {
        padding: 30px 15px;
        margin-top: 40px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-col {
        margin-bottom: 0;
    }
    
    .social-links {
        display: flex;
        gap: 10px;
    }
    
    .social-link {
        width: 40px;
        height: 40px;
    }
    
    .social-link img {
        width: 24px;
        height: 24px;
    }
    
    /* Анимации */
    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
    
    .mobile-menu.active {
        animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Touch optimizations */
    .mobile-nav-link,
    .mobile-league-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Smooth scroll */
    html {
        scroll-behavior: smooth;
    }
    
    body {
        -webkit-font-smoothing: antialiased;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .logo img {
        height: 40px !important;
        max-width: 100px;
    }
    
    .league-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .league-logo {
        height: 16px !important;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .calendar-grid {
        font-size: 0.7rem;
    }
    
    .calendar-day {
        min-height: 50px;
    }
    
    .mobile-menu {
        width: 90%;
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-menu {
        max-height: 100vh;
    }
    
    .mobile-nav-link {
        padding: 12px 20px;
    }
}
