/* КРАСИВЫЕ ВКЛАДКИ */
.modern-tabs {
    display: flex;
    flex-wrap: wrap; /* Теперь вкладки не вылезают */
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: none;
    background: #f8fafc;
    padding: 8px;
    border-radius: 60px;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tab-modern {
    display: inline-flex; /* flex → inline-flex для корректного переноса */
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 40px;
    text-decoration: none;
    transition: all 0.25s ease;
    background: transparent;
    color: #475569;
    border: none;
    cursor: pointer;
    white-space: nowrap; /* Чтобы текст внутри не переносился */
}

@media (max-width: 640px) {
    .tab-modern {
        padding: 8px 16px;
        font-size: 13px;
    }
}

.tab-modern i {
    font-size: 16px;
    transition: transform 0.2s;
}

.tab-modern:hover {
    background: #eef2ff;
    color: #4f46e5;
    transform: translateY(-1px);
}

.tab-modern:hover i {
    transform: scale(1.05);
}

.tab-modern.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.4);
}

.tab-modern.active i {
    color: white;
}

/* КАТЕГОРИИ С ПРОКРУТКОЙ */
.cats-scroll {
    overflow-x: auto;
    white-space: nowrap;
    padding: 8px 0 16px 0;
    margin-bottom: 20px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cats-scroll::-webkit-scrollbar {
    height: 6px;
}

.cats-scroll::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 10px;
}

.cats-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.cats-flex {
    display: inline-flex;
    gap: 10px;
    padding: 4px 4px;
}

.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.cat-pill i {
    font-size: 13px;
    color: #6b7280;
}

.cat-pill.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cat-pill.active i {
    color: white;
}

.cat-pill:hover:not(.active) {
    border-color: #4f46e5;
    background: #f5f3ff;
    transform: translateY(-2px);
}

.cat-more {
    background: #f1f5f9;
    border: 1.5px dashed #cbd5e1;
}

.cat-more:hover {
    background: #eef2ff;
    border-color: #4f46e5;
}

/* Остальные стили (ваши существующие, без изменений) */
.cat-wrap{max-width:1200px;margin:0 auto;padding:24px 20px}
.cat-title{font-size:24px;font-weight:800;color:#0f172a;margin-bottom:20px}
.search-form{display:flex;gap:8px;flex:1;flex-wrap:wrap;margin-bottom:20px}
.search-form input,.search-form select{padding:9px 14px;border:1.5px solid #e2e8f0;border-radius:10px;font-size:13px;font-family:inherit;background:#fff}
.search-form input:focus,.search-form select:focus{border-color:#4f46e5;outline:none}
.search-form button{padding:9px 18px;background:#4f46e5;color:#fff;border:none;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer}
.search-form button:hover{background:#4338ca}
.cat-meta{font-size:12px;color:#94a3b8;margin-bottom:4px}
.sort-tabs{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.sort-tabs a{padding:6px 14px;border-radius:8px;font-size:12px;font-weight:600;text-decoration:none;color:#64748b;background:#f1f5f9;transition:.15s;white-space:nowrap}
.sort-tabs a.active{background:#4f46e5;color:#fff}
.sort-tabs a:hover:not(.active){background:#eef2ff;color:#4f46e5}
.company-grid.grid-view{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:20px}
.company-grid.list-view{display:flex;flex-direction:column;gap:16px}
.company-grid.list-view .company-card{display:flex;align-items:center;gap:20px}
.company-grid.list-view .company-logo-wrap{width:100px;height:100px;flex-shrink:0}
.company-grid.list-view .company-actions{margin-left:auto;flex-shrink:0}
.company-card{background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.05);border:1px solid #e2e8f0;transition:transform .15s,box-shadow .15s}
.company-card:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(0,0,0,.08)}
.company-logo-wrap{width:100%;height:160px;overflow:hidden;background:#f8fafc;display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative}
.company-logo-wrap img{width:100%;height:100%;object-fit:cover}
.logo-overlay{position:absolute;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s;color:#fff;font-size:14px;gap:6px}
.company-logo-wrap:hover .logo-overlay{opacity:1}
.company-info{padding:16px}
.company-name{font-size:16px;font-weight:700;margin-bottom:4px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.company-name a{color:#0f172a;text-decoration:none}
.company-name a:hover{color:#4f46e5}
.verified-badge{color:#22c55e;font-size:14px}
.company-description{font-size:12px;color:#64748b;margin:6px 0}
.lp-ring{position:absolute;top:8px;left:8px;z-index:10;width:88px;height:88px;pointer-events:none}
.lp-ring svg{width:88px;height:88px;display:block}
.lp-ring-num{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}
.lp-ring-num span:first-child{font-size:22px;font-weight:700;line-height:1;color:#fff}
.lp-ring-num span:last-child{font-size:11px;line-height:1;margin-top:2px;color:rgba(255,255,255,.85)}
.fav-btn{position:absolute;top:8px;right:8px;z-index:10;width:34px;height:34px;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .15s,background .15s;background:rgba(255,255,255,.85);backdrop-filter:blur(4px);box-shadow:0 1px 4px rgba(0,0,0,.15)}
.fav-btn i{font-size:14px;color:#cbd5e1;transition:color .15s}
.fav-btn.active i,.fav-btn:hover i{color:#ef4444}
.fav-btn:hover{transform:scale(1.12);background:#fff}
.fav-btn.active{background:#fff5f5}
.fav-btn.loading{pointer-events:none;opacity:.6}
.partner-pill{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:700;padding:3px 9px;border-radius:20px;background:linear-gradient(90deg,#667eea22,#764ba222);color:#667eea;white-space:nowrap;border:1px solid #667eea44;text-decoration:none}
.partner-pill:hover{background:linear-gradient(90deg,#667eea33,#764ba233)}
.company-actions{padding:12px 16px;border-top:1px solid #f1f5f9;display:flex;gap:8px}
.action-btn{padding:6px 14px;border-radius:8px;font-size:12px;font-weight:600;text-decoration:none;text-align:center;background:#f8fafc;color:#64748b;border:1px solid #e2e8f0;transition:.15s}
.action-btn:hover{background:#eff6ff;border-color:#bfdbfe;color:#2563eb}
.action-primary{background:#4f46e5;color:#fff;border:none}
.action-primary:hover{background:#4338ca;color:#fff}
.cat-empty{text-align:center;padding:60px 20px;color:#94a3b8}
.cat-empty i{font-size:40px;display:block;margin-bottom:12px;opacity:.3}
.cat-pagination{display:flex;justify-content:center;gap:6px;margin-top:24px;flex-wrap:wrap}
.cat-pagination a{padding:8px 14px;border-radius:8px;background:#f1f5f9;text-decoration:none;font-size:13px;color:#4f46e5}
.cat-pagination a.active{background:#4f46e5;color:#fff}
.cat-pagination a:hover:not(.active){background:#eef2ff}
@media(max-width:640px){.company-grid.grid-view{grid-template-columns:1fr}}
@media (max-width: 640px) {
    .company-grid.list-view .company-card{flex-direction:row;align-items:stretch;gap:0;min-height:140px}
    .company-grid.list-view .company-logo-wrap{width:110px!important;height:auto!important;flex-shrink:0;border-radius:12px 0 0 12px;position:relative}
    .company-grid.list-view .company-logo-wrap img{object-fit:cover;width:100%;height:100%;position:absolute;top:0;left:0}
    .company-grid.list-view .company-info{flex:1;padding:10px 12px;overflow:hidden;display:flex;flex-direction:column;justify-content:center}
    .company-grid.list-view .company-actions{display:none}
    .company-name{font-size:13px;gap:4px;margin-bottom:4px}
    .company-description{font-size:10px;line-height:1.3;margin:4px 0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
    .company-meta{gap:4px;margin:3px 0 4px!important}
    .company-meta span{font-size:9px;padding:1px 5px}
    .partner-pill{font-size:9px;padding:2px 5px;white-space:nowrap}
    .lp-ring{width:50px!important;height:50px!important;top:4px;left:4px}
    .lp-ring svg{width:50px!important;height:50px!important}
    .lp-ring-num span:first-child{font-size:12px}
    .lp-ring-num span:last-child{font-size:7px}
    .fav-btn{width:26px;height:26px;top:4px;right:4px}
    .fav-btn i{font-size:11px}
}

/* Модальное окно для всех категорий */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
}
.modal-cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.modal-cat-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s;
}
.modal-cat-link:hover {
    background: #eef2ff;
    transform: translateX(4px);
}

/* ═══════════ МОБИЛЬНАЯ ВЕРСИЯ КАТАЛОГА ═══════════ */
@media (max-width: 760px) {
    /* Вкладки: перенос строк, компактнее */
    .modern-tabs {
        width: 100%;
        gap: 8px;
        padding: 8px;
        border-radius: 16px;
        margin-bottom: 20px;
        box-sizing: border-box;
        justify-content: flex-start;
    }
    .tab-modern {
        padding: 8px 14px;
        font-size: 13px;
        gap: 6px;
        white-space: nowrap;
    }
    .tab-modern i { font-size: 13px; }

    /* Поиск: на мобильных вертикально */
    .search-form { flex-direction: column; gap: 8px; margin-bottom: 14px; }
    .search-form input,
    .search-form select,
    .search-form button,
    .search-form a { width: 100%; box-sizing: border-box; }

    /* Категории-пилюли: горизонтальный скролл */
    .cats-scroll { margin: 0 -16px 4px; }
    .cats-flex {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        padding: 0 16px 6px;
    }
    .cats-flex::-webkit-scrollbar { display: none; }
    .cat-pill { flex: 0 0 auto; white-space: nowrap; }

    /* Сортировка: горизонтальный скролл */
    .sort-tabs {
        width: 100%;
        overflow-x: auto;

        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 8px;
    }
    .sort-tabs::-webkit-scrollbar {
        height: 4px;
    }
    .sort-tabs::-webkit-scrollbar-track {
        background: #e2e8f0;
        border-radius: 10px;
    }
    .sort-tabs::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }
    .sort-tabs a {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 11px;
        padding: 5px 12px;
    }

    /* Карточки в одну колонку */
    .company-grid.grid-view { grid-template-columns: 1fr; gap: 14px; }

    /* Модалка категорий компактнее */
    .modal-content { width: 94%; padding: 18px; border-radius: 18px; }
    .modal-cats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .modal-cat-link { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 480px) {
    .tab-modern { padding: 6px 12px; font-size: 12px; }
    .modal-cats-grid { grid-template-columns: 1fr; }
}

/* КАТЕГОРИИ В ВИДЕ СЕТКИ (ТАБЛИЧКИ) */
.cats-grid-container {
    margin-bottom: 28px;
}

.cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.cat-card-icon i {
    font-size: 20px;
    color: #6b7280;
}

.cat-card-label {
    font-size: 12px;
    line-height: 1.3;
}

/* Активная категория в сетке */
.cat-card.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.4);
    position: relative;
}

.cat-card.active .cat-card-icon i {
    color: white;
}

.cat-card.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    background: #22c55e;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cat-card:hover:not(.active) {
    border-color: #4f46e5;
    background: #f5f3ff;
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.05);
}

.cats-show-more {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.cat-show-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-show-all-btn:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    transform: translateY(-2px);
}

/* Мобильная адаптация сетки */
@media (max-width: 640px) {
    .cats-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    .cat-card {
        padding: 10px 6px;
    }
    .cat-card-icon i {
        font-size: 16px;
    }
    .cat-card-label {
        font-size: 10px;
    }
    .cat-show-all-btn {
        padding: 8px 18px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .cats-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }
}

/* Модальное окно для всех категорий — расширенное */
.modal-content-wide {
    max-width: 900px;
    width: 90%;
}

.modal-body {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-cat-group {
    margin-bottom: 24px;
}

.modal-cat-group:last-child {
    margin-bottom: 0;
}

.modal-cat-group-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-cat-group-title i {
    color: #4f46e5;
    font-size: 14px;
}

.modal-cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.modal-cat-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.modal-cat-link i {
    width: 24px;
    font-size: 14px;
    color: #4f46e5;
    text-align: center;
}

.modal-cat-link:hover {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    transform: translateX(4px);
    color: #4f46e5;
}

/* Мобильная адаптация */
@media (max-width: 640px) {
    .modal-content-wide {
        width: 95%;
        padding: 18px;
    }

    .modal-cats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .modal-cat-group-title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .modal-cat-link {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Активная категория в модальном окне */
.modal-cat-link.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.modal-cat-link.active i {
    color: white;
}

.modal-cat-link.active .fa-check-circle {
    color: white !important;
}

.modal-cat-link.active:hover {
    transform: translateX(4px);
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}
