/* ========================================
   MOBILE v79.1 (HERO SLIDER RESTORED)
   Сэндвич работает, меню плоское, слайдер возвращен
   ======================================== */

/* --- МОБИЛЬНАЯ ВЕРСИЯ (до 768px) --- */
@media (max-width: 768px) {
    
    /* 1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ */
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    
    html, body {
        width: 100%;
        overflow-x: hidden !important;
        margin: 0;
        padding: 0;
        background-color: #ffffff;
    }

    .header .container, 
    .header-inner-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 2. ШАПКА И СЕНДВИЧ-МЕНЮ (БЕЗ КРЕСТИКА) */
    .header {
        position: sticky; top: 0; z-index: 2000;
        background: white; width: 100%;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        padding: 0; margin-bottom: 10px;
    }
    .header-inner {
        width: 100% !important; height: 60px !important;
        display: flex; flex-direction: row; align-items: center; 
        justify-content: space-between;
        padding: 0 10px !important; margin: 0 !important;
        background: white; box-shadow: none !important;
    }
    .logo { 
        order: 1; font-size: 1.1rem; margin: 0 !important; 
        margin-left: 5px !important; white-space: nowrap; color: #1e293b;
        display: flex; align-items: center; gap: 8px;
        text-decoration: none !important;
    }
    .logo-icon { width: 32px !important; height: 32px !important; }
    .btn-add-org { display: none; }
    
    /* Иконка сэндвича (псевдоэлемент справа) */
    .header-inner::after {
        content: '\f0c9'; font-family: "Font Awesome 6 Free"; font-weight: 900;
        order: 3; font-size: 24px; color: #334155; padding: 10px;
        margin-right: 5px !important; cursor: pointer; display: block; z-index: 2001;
    }
    
    /* Затемнение фона при открытом меню */
    .nav-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 1999;
        opacity: 0; visibility: hidden; transition: 0.3s;
    }
    .nav-overlay.active { opacity: 1; visibility: visible; }
    
    /* Само меню выезжает справа */
    .nav {
        position: fixed; top: 0; right: 0; width: 85%; max-width: 300px; height: 100vh;
        background: white; flex-direction: column; align-items: stretch;
        padding: 70px 20px 20px; gap: 4px; transform: translateX(100%);
        transition: transform 0.3s ease; z-index: 2000;
        box-shadow: -5px 0 25px rgba(0,0,0,0.15); overflow-y: auto; display: flex !important;
    }
    .nav.menu-open { transform: translateX(0); }
    
    /* Пункты меню - ВСЕ ОДИНАКОВЫЕ, БЕЗ ВЫПАДАЮЩИХ */
    .nav-link,
    .nav-dropdown-toggle,
    .dropdown-item {
        width: 100%; padding: 14px 16px; background: transparent;
        border-radius: 12px; font-size: 16px; font-weight: 500;
        color: #334155; text-align: left; text-decoration: none;
        display: block !important; border: none; cursor: pointer;
        line-height: 1.4;
    }
    
    .nav-link:hover, .nav-link.active,
    .nav-dropdown-toggle:hover,
    .dropdown-item:hover {
        background: #eff6ff; color: #2563eb;
    }
    
    /* Превращаем выпадающее меню в обычный плоский список */
    .nav-dropdown {
        width: 100%; margin-top: 0; border: none;
    }
    .nav-dropdown-menu {
        display: block !important; /* Всегда видим */
        margin-top: 0; padding-left: 16px; /* Отступ для вложенных */
        position: static !important;
        opacity: 1 !important; visibility: visible !important;
        transform: none !important; pointer-events: auto !important;
        box-shadow: none !important; border: none !important;
        background: transparent !important; width: 100% !important;
    }
    .dropdown-columns {
        display: block !important; gap: 0;
    }
    .dropdown-header {
        font-size: 0.8rem; font-weight: 700; color: #94a3b8;
        margin: 12px 0 4px 0; text-transform: uppercase;
        letter-spacing: 0.5px; padding: 0 16px;
    }
    .dropdown-item {
        padding: 10px 16px; font-size: 15px; color: #475569;
    }

    /* 2.5. ГЛАВНЫЙ СЛАЙДЕР (ВОССТАНОВЛЕН) */
    .hero-slider {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
    }
    
    .hero-slider-wrapper {
        width: 100% !important;
        padding: 0 16px !important; /* Боковые отступы как у остальных блоков */
        box-sizing: border-box !important;
    }
    
    .hero-slider-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 220px !important; /* Адаптивная высота для мобильного */
        border-radius: 20px !important;
        position: relative !important;
        display: block !important;
        overflow: hidden !important;
        background: #e2e8f0 !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    }
    
    .hero-slide {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        opacity: 0 !important;
        transition: opacity 0.5s ease !important;
        display: block !important;
    }
    
    .hero-slide.active {
        opacity: 1 !important;
        z-index: 2 !important;
    }
    
    .hero-slide-bg {
        width: 100% !important; height: 100% !important;
        background-size: cover !important;
        background-position: center !important;
    }
    
    .hero-slide-overlay {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        background: rgba(0,0,0,0.4) !important;
        z-index: 2 !important;
    }
    
    .hero-slide-content {
        position: absolute !important;
        top: 50% !important; left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 100% !important;
        text-align: center !important;
        z-index: 3 !important;
        padding: 0 10px !important;
    }
    
    .hero-title {
        font-size: 1.2rem !important;
        color: white !important;
        margin-bottom: 10px !important;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
        font-weight: 700 !important;
    }
    
    .hero-search {
        width: 95% !important;
        height: 44px !important;
        margin: 0 auto !important;
        background: white !important;
        border-radius: 22px !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 5px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    }
    
    .hero-search input {
        border: none !important; outline: none !important;
        flex-grow: 1 !important; padding-left: 15px !important;
        font-size: 14px !important;
    }
    
    .hero-search button {
        background: #2563eb !important; color: white !important;
        border: none !important; width: 36px !important; height: 36px !important;
        border-radius: 50% !important; display: flex !important;
        align-items: center !important; justify-content: center !important;
        cursor: pointer !important;
    }
    
    .hero-subtitle {
        font-size: 0.75rem !important;
        color: white !important;
        margin-top: 8px !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5) !important;
        opacity: 0.9 !important;
    }
    
    /* Стрелки слайдера */
    .slider-prev, .slider-next {
        position: absolute !important;
        top: 50% !important; transform: translateY(-50%) !important;
        z-index: 10 !important;
        background: rgba(255,255,255,0.2) !important;
        border: none !important; backdrop-filter: blur(4px) !important;
        width: 32px !important; height: 32px !important;
        border-radius: 50% !important; color: white !important;
        display: flex !important; align-items: center !important;
        justify-content: center !important;
    }
    .slider-prev { left: 10px !important; }
    .slider-next { right: 10px !important; }
    
    /* Точки слайдера */
    .slider-dots {
        position: absolute !important;
        bottom: 12px !important; left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important; gap: 6px !important;
        z-index: 10 !important;
    }
    .slider-dot {
        width: 6px !important; height: 6px !important;
        background: rgba(255,255,255,0.5) !important;
        border-radius: 50% !important; transition: 0.3s !important;
    }
    .slider-dot.active {
        background: white !important; width: 18px !important;
        border-radius: 3px !important;
    }

    /* 3. КАТЕГОРИИ МОБИЛЬНЫЕ (4x2) */
    body.is-mobile .categories-section .white-card {
        padding: 15px 0 !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    body.is-mobile .section-header { 
        padding: 0 16px !important; margin-bottom: 15px !important; 
        display: flex !important; justify-content: space-between !important; 
        align-items: baseline !important; 
    }
    body.is-mobile .section-title { 
        font-size: 1.3rem !important; font-weight: 800 !important; 
        color: #1e293b !important; margin: 0 !important; 
    }
    body.is-mobile .categories-count { 
        font-size: 0.85rem !important; color: #94a3b8 !important; 
        font-weight: 500 !important; 
    }
    body.is-mobile .categories-grid-responsive {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        padding: 0 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        background: transparent !important;
        border: none !important;
    }
    body.is-mobile .category-card {
        min-width: 0 !important; width: 100% !important; height: auto !important;
        display: flex !important; flex-direction: column !important;
        align-items: center !important; justify-content: center !important;
        background: transparent !important; border: none !important;
        box-shadow: none !important; border-radius: 0 !important;
        padding: 10px 2px !important; text-decoration: none !important;
    }
    body.is-mobile .category-card:active {
        opacity: 0.7 !important; transform: scale(0.95) !important;
    }
    body.is-mobile .category-icon {
        width: 42px !important; height: 42px !important; min-width: 42px !important;
        margin-bottom: 6px !important; margin-right: 0 !important;
        background: transparent !important; border-radius: 0 !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
    }
    body.is-mobile .category-icon i { font-size: 24px !important; color: #475569 !important; }
    body.is-mobile .category-name {
        font-size: 11px !important; font-weight: 500 !important; color: #475569 !important;
        text-align: center !important; line-height: 1.2 !important; width: 100% !important;
        display: -webkit-box !important; -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important; overflow: hidden !important;
        word-break: break-word !important;
    }
    body.is-mobile .show-all-wrapper { padding: 0 16px; margin-top: 15px; }
    body.is-mobile .btn-show-all {
        width: 100%; padding: 12px; background: white;
        border: 1px solid #e2e8f0; border-radius: 12px;
        font-weight: 600; color: #475569; font-size: 14px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    }

    /* 4. КОМПАНИИ (КОМПАКТНЫЕ, БЕЗ ПУСТОТЫ) */
    .companies-section .container { padding: 0 16px !important; }
    .section-subtitle { font-size: 1.3rem; font-weight: 800; color: #1e293b; margin-bottom: 15px; }
    .companies-grid { grid-template-columns: 1fr !important; gap: 16px; }
    
    .company-card { 
        width: 100% !important; 
        border-radius: 16px; 
        overflow: hidden; 
        background: white; 
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        height: auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .company-image-wrapper { height: 180px !important; }
    
    .company-content { 
        padding: 16px; 
        flex-grow: 0 !important;
        padding-bottom: 12px !important;
    }
    
    .company-footer {
        margin-top: auto !important;
        padding-top: 10px !important;
    }

    /* 5. НОВОСТИ, АФИША И РЕКЛАМА */
    .news-layout { 
        grid-template-columns: 1fr !important; 
        gap: 20px !important;
        display: block !important;
    }
    
    /* Карточка новости */
    .news-card-horizontal { 
        flex-direction: column !important; 
        padding: 0 !important; 
        border-radius: 16px; 
        margin-bottom: 16px; 
        background: white !important; 
        overflow: visible !important;
        display: flex !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
        border: 1px solid #f1f5f9 !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    .news-card-image { 
        width: 100% !important; 
        height: 200px !important; 
        object-fit: cover;
        display: block !important;
        flex-shrink: 0;
    }

    .news-card-content {
        padding: 16px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        min-height: auto !important;
        background: white !important;
        color: #334155 !important;
        flex-grow: 1;
        width: 100% !important;
    }

    .news-card-content * {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        overflow: visible !important;
        -webkit-line-clamp: unset !important;
        text-overflow: clip !important;
        white-space: normal !important;
    }

    .news-date {
        font-size: 12px !important;
        color: #94a3b8 !important;
        margin-bottom: 6px !important;
    }

    .news-card-title {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
        margin: 8px 0 !important;
        color: #1e293b !important;
        font-weight: 700 !important;
    }

    .news-footer {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f1f5f9 !important;
        font-size: 0.85rem;
        color: #64748b;
    }

    /* --- АФИША (БЕЗ ПЛАШКИ, ЧИСТЫЙ БЛОК) --- */
    .sidebar-afisha-block, 
    #afishaBanner {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        overflow: hidden !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        position: relative !important;
        border-radius: 16px !important;
        aspect-ratio: 9 / 20 !important; 
        height: auto !important;
        min-height: 0 !important;
    }
    .afisha-label { display: none !important; }
    .sidebar-afisha-block .afisha-slide,
    .sidebar-afisha-block .banner-slide,
    #afishaBanner .afisha-slide,
    #afishaBanner .banner-slide {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        opacity: 0 !important; visibility: hidden !important;
        transition: opacity 1s ease-in-out !important;
        z-index: 1 !important; display: block !important;
    }
    .sidebar-afisha-block .afisha-slide.active,
    .sidebar-afisha-block .banner-slide.active,
    #afishaBanner .afisha-slide.active,
    #afishaBanner .banner-slide.active {
        opacity: 1 !important; visibility: visible !important; z-index: 2 !important;
    }
    .sidebar-afisha-block img, #afishaBanner img {
        width: 100% !important; height: 100% !important;
        display: block !important; object-fit: cover !important;
    }
    .afisha-dots, .banner-dots { display: none !important; }

    /* --- РЕКЛАМНЫЙ БАННЕР (БЕЗ ПУСТОТЫ СВЕРХУ И СНИЗУ) --- */
    .ad-banner-section,
    .ad-banner-wrapper,
    #adBanner {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        position: relative !important;
        overflow: hidden !important;
        aspect-ratio: 21 / 9 !important; 
        height: auto !important;
        min-height: 0 !important;
    }
    .ad-banner-full .banner-slide,
    .ad-banner-section .banner-slide,
    #adBanner .banner-slide {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 1s ease-in-out !important;
        z-index: 1 !important;
        display: block !important;
    }
    .ad-banner-full .banner-slide.active,
    .ad-banner-section .banner-slide.active,
    #adBanner .banner-slide.active {
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 2 !important;
    }
    .ad-banner-full img,
    .ad-banner-section img,
    #adBanner img {
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        object-fit: cover !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .ad-label, 
    .banner-dots,
    .ad-banner-label,
    .ad-title,
    .ad-caption,
    [class*="ad-label"],
    [class*="dots"] {
        display: none !important;
    }

    /* 6. ИНФО-БЛОКИ (ОДИН ПОД ДРУГИМ ВО ВСЮ ШИРИНУ) */
    .info-sections {
        padding: 20px 16px !important;
        width: 100% !important;
    }
    .info-grid-redesigned {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }
    .info-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 32px 20px !important;    
        min-height: 520px !important;
        border-radius: 16px !important;
        background: white !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
        border: 1px solid #f1f5f9 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
        justify-content: center !important;
    }
    .info-card h3 {
        font-size: 1.2rem !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        margin: 0 0 12px 0 !important;
        line-height: 1.3 !important;
        width: 100% !important;
    }
    .info-card p {
        font-size: 0.95rem !important;
        color: #64748b !important;
        line-height: 1.5 !important;
        margin: 0 0 16px 0 !important;
        width: 100% !important;
    }
    .info-card img {
        width: 100% !important;
        max-width: 280px !important;
        height: auto !important;
        margin: 0 auto 20px auto !important;
        display: block !important;
        object-fit: contain !important;
    }
    .info-card a.btn-work-primary,
    .info-card a.btn-info-outline {
        width: 100% !important;
        max-width: 280px !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        text-align: center !important;
        text-decoration: none !important;
        display: inline-block !important;
        box-sizing: border-box !important;
    }

    /* 7. СТРАНИЦА КОМПАНИИ (COMPANY.PHP) */
    .company-detail-section .container {
        padding: 0 16px !important;
    }
    .company-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    .company-hero-card {
        margin-bottom: 0 !important;
        border-radius: 16px !important;
        overflow: hidden !important;
    }
    .company-hero-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    .company-hero-header .company-title {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
    }
    .hero-tags {
        flex-wrap: wrap !important;
    }
    .company-slider-wrapper {
        height: 250px !important;
        border-radius: 0 !important;
    }
    .slider-arrow {
        padding: 0.5rem !important;
        font-size: 1.2rem !important;
    }
    .slider-thumbnails-strip {
        padding: 12px 16px !important;
        gap: 8px !important;
    }
    .thumb-item {
        width: 60px !important;
        height: 45px !important;
    }
    .company-sidebar {
        position: static !important;
        width: 100% !important;
    }
    .sidebar-ad-card,
    .company-services-card,
    .company-features-card,
    .company-phone-card,
    .company-details-card,
    .company-description-card,
    .company-map-card,
    .company-reviews-card {
        border-radius: 16px !important;
        margin-bottom: 16px !important;
        padding: 16px !important;
    }
    .phone-buttons-container {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .phone-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 12px 16px !important;
        font-size: 1rem !important;
    }
    .details-body {
        padding: 16px !important;
    }
    .detail-row {
        flex-direction: column !important;
        gap: 4px !important;
        margin-bottom: 16px !important;
        padding-bottom: 16px !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }
    .detail-row:last-child {
        border-bottom: none !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    .detail-icon {
        display: none !important;
    }
    .social-icons-row {
        justify-content: center !important;
        gap: 12px !important;
    }
    .social-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
    }
    .map-placeholder {
        height: 200px !important;
        border-radius: 12px !important;
    }
    .review-item {
        padding-bottom: 16px !important;
        margin-bottom: 16px !important;
    }
}

/* --- ДЕСКТОПНАЯ ВЕРСИЯ (от 769px и выше) --- */
@media (min-width: 769px) {
    
    /* Категории в одну строку (8 колонок) */
    .categories-grid-responsive {
        display: grid !important;
        grid-template-columns: repeat(8, 1fr) !important;
        gap: 15px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* Карточки категорий на десктопе */
    .categories-grid-responsive .category-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        min-width: 0 !important;
        padding: 10px 5px !important;
    }

    /* Иконки на десктопе */
    .categories-grid-responsive .category-icon {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 10px !important;
        margin-right: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .categories-grid-responsive .category-icon img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    /* Текст на десктопе */
    .categories-grid-responsive .category-name {
        font-size: 13px !important;
        line-height: 1.3 !important;
        display: block !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
    }
}