/* ============================================
   ФИНАЛЬНЫЙ CSS для таблицы категорий брендов
   Версия 1.0
   ============================================ */

/* Основные стили таблицы */
#brands-categories-table {
    display: block !important;
    width: 100% !important;
    margin: 25px 0 30px !important;
}

/* Grid контейнер для карточек */
#brands-categories-table tbody {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* 4 колонки на десктопе */
    gap: 20px !important;
    align-items: stretch !important; /* Выравниваем по высоте */
    margin: 0 !important;
}

#brands-categories-table tr {
    display: contents !important;
}

/* Стили карточки */
#brands-categories-table td {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    background: white !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    text-align: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
    height: 100% !important;
    min-height: 220px !important;
    cursor: pointer !important;
    position: relative !important;
}

/* Эффект при наведении */
#brands-categories-table td:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border-color: #007bff !important;
}

/* Верхняя часть - контейнер изображения */
#brands-categories-table td > div:first-child {
    height: 150px !important;
    min-height: 150px !important;
    max-height: 150px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 25px 20px !important;
    flex-shrink: 0 !important;
}

/* Изображение бренда */
#brands-categories-table td img {
    max-height: 90px !important;
    max-width: 90% !important;
    height: auto !important;
    width: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease !important;
}

#brands-categories-table td:hover img {
    transform: scale(1.05) !important;
}

/* Нижняя часть - текстовый блок */
#brands-categories-table td > div:nth-child(2) {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 15px !important;
    text-align: center !important;
    min-height: 70px !important;
    background: white !important;
    border-radius: 0 0 12px 12px !important;
}

/* Текст в карточке */
#brands-categories-table td > div:nth-child(2) a {
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    text-transform: uppercase !important;
    display: block !important;
    width: 100% !important;
    transition: color 0.3s ease !important;
}

#brands-categories-table td:hover > div:nth-child(2) a {
    color: #007bff !important;
}

/* Заголовок "Категории раздела" */
#category_description_full > div:first-child {
    background-color: #007bff
    color: white !important;
    padding: 12px 20px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    border-radius: 8px 8px 0 0 !important;
    margin-bottom: 0 !important;
    text-align: center !important;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Планшеты (1200px) - 3 колонки */
@media (max-width: 1200px) {
    #brands-categories-table tbody {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Планшеты (992px) - 3 колонки */
@media (max-width: 992px) {
    #brands-categories-table tbody {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
    }
    
    #brands-categories-table td {
        min-height: 210px !important;
    }
    
    #brands-categories-table td > div:first-child {
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
        padding: 20px 15px !important;
    }
    
    #brands-categories-table td img {
        max-height: 85px !important;
    }
}

/* Планшеты (768px) - 2 колонки */
@media (max-width: 768px) {
    #brands-categories-table tbody {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    #brands-categories-table td {
        min-height: 200px !important;
    }
    
    #brands-categories-table td > div:first-child {
        height: 130px !important;
        min-height: 130px !important;
        max-height: 130px !important;
        padding: 18px 12px !important;
    }
    
    #brands-categories-table td img {
        max-height: 80px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) {
        padding: 18px 12px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) a {
        font-size: 13px !important;
    }
}

/* Мобильные (576px) - 2 колонки */
@media (max-width: 576px) {
    #brands-categories-table tbody {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    #brands-categories-table td {
        min-height: 190px !important;
    }
    
    #brands-categories-table td > div:first-child {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        padding: 15px 10px !important;
    }
    
    #brands-categories-table td img {
        max-height: 75px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) {
        padding: 15px 10px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) a {
        font-size: 12px !important;
    }
}

/* Маленькие мобильные (480px) - 2 колонки компактнее */
@media (max-width: 480px) {
    #brands-categories-table tbody {
        gap: 10px !important;
    }
    
    #brands-categories-table td {
        min-height: 180px !important;
        border-radius: 10px !important;
    }
    
    #brands-categories-table td > div:first-child {
        height: 110px !important;
        min-height: 110px !important;
        max-height: 110px !important;
        padding: 12px 8px !important;
        border-radius: 10px 10px 0 0 !important;
    }
    
    #brands-categories-table td img {
        max-height: 70px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) {
        padding: 12px 8px !important;
        border-radius: 0 0 10px 10px !important;
    }
    
    #brands-categories-table td > div:nth-child(2) a {
        font-size: 11px !important;
    }
}

/* Очень маленькие экраны (360px) - 1 колонка */
@media (max-width: 360px) {
    #brands-categories-table tbody {
        grid-template-columns: 1fr !important;
        max-width: 280px !important;
        margin: 0 auto !important;
    }
    
    #brands-categories-table td {
        min-height: 200px !important;
    }
}
/* ============================================
   ТАБЛИЦА С БОЛЬШИМИ КАРТИНКАМИ (Waterjet Nozzles)
   ID: large-images-table
   ============================================ */

#large-images-table {
    display: block !important;
    width: 100% !important;
    margin: 25px 0 30px !important;
}

/* Grid контейнер для карточек с большими изображениями */
#large-images-table tbody {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* 3 колонки для больших картинок */
    gap: 25px !important;
    align-items: stretch !important;
    margin: 0 !important;
}

#large-images-table tr {
    display: contents !important;
}

/* Стили карточки с увеличенным местом для изображения */
#large-images-table td {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    background: white !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    text-align: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
    height: 100% !important;
    min-height: 280px !important; /* Увеличили высоту */
    cursor: pointer !important;
    position: relative !important;
}

/* Эффект при наведении */
#large-images-table td:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border-color: #007bff !important;
}

/* УВЕЛИЧЕННАЯ ВЕРХНЯЯ ЧАСТЬ ДЛЯ КАРТИНОК */
#large-images-table td > div:first-child {
    height: 200px !important; /* Увеличили высоту */
    min-height: 200px !important;
    max-height: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 30px 25px !important; /* Увеличили паддинг */
    flex-shrink: 0 !important;
}

/* УВЕЛИЧЕННЫЕ ИЗОБРАЖЕНИЯ */
#large-images-table td img {
    max-height: 140px !important; /* Увеличили максимальную высоту */
    max-width: 95% !important; /* Увеличили максимальную ширину */
    height: auto !important;
    width: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease !important;
}

#large-images-table td:hover img {
    transform: scale(1.08) !important; /* Более заметное увеличение */
}

/* Нижняя часть - текстовый блок */
#large-images-table td > div:nth-child(2) {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 25px 20px !important; /* Увеличили паддинг */
    text-align: center !important;
    min-height: 80px !important;
    background: white !important;
    border-radius: 0 0 12px 12px !important;
}

/* Текст в карточке */
#large-images-table td > div:nth-child(2) a {
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 16px !important; /* Увеличили шрифт */
    line-height: 1.4 !important;
    text-transform: uppercase !important;
    display: block !important;
    width: 100% !important;
    transition: color 0.3s ease !important;
}

#large-images-table td:hover > div:nth-child(2) a {
    color: #007bff !important;
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ ТАБЛИЦЫ С БОЛЬШИМИ КАРТИНКАМИ
   ============================================ */

/* ============================================
   МОБИЛЬНАЯ ВЕРСИЯ ДЛЯ ТАБЛИЦЫ С БОЛЬШИМИ КАРТИНКАМИ
   Оптимизировано: убраны лишние отступы
   ============================================ */

/* Планшеты (992px) - оптимизация */
@media (max-width: 992px) {
    #large-images-table tbody {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important; /* Уменьшили отступы между карточками */
    }
    
    #large-images-table td {
        min-height: 240px !important; /* Уменьшили общую высоту */
    }
    
    /* УБИРАЕМ ЛИШНИЕ ОТСТУПЫ ВОКРУГ КАРТИНКИ */
    #large-images-table td > div:first-child {
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
        padding: 15px 12px !important; /* Уменьшили паддинги в 2 раза */
    }
    
    /* УВЕЛИЧИВАЕМ САМУ КАРТИНКУ ОТНОСИТЕЛЬНО КОНТЕЙНЕРА */
    #large-images-table td img {
        max-height: 120px !important; /* Картинка теперь занимает больше места */
        max-width: 98% !important; /* Почти на всю ширину */
    }
    
    /* Уменьшаем нижнюю часть */
    #large-images-table td > div:nth-child(2) {
        padding: 15px 12px !important; /* Меньше отступов */
        min-height: 70px !important;
    }
    
    /* Уменьшаем текст */
    #large-images-table td > div:nth-child(2) a {
        font-size: 15px !important;
        line-height: 1.3 !important;
    }
}

/* Планшеты (768px) - еще компактнее */
@media (max-width: 768px) {
    #large-images-table tbody {
        gap: 14px !important;
    }
    
    #large-images-table td {
        min-height: 230px !important;
        border-radius: 10px !important;
    }
    
    /* ЕЩЕ МЕНЬШЕ ПУСТОГО ПРОСТРАНСТВА ВОКРУГ КАРТИНКИ */
    #large-images-table td > div:first-child {
        height: 150px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        padding: 12px 10px !important; /* Минимальные отступы */
        border-radius: 10px 10px 0 0 !important;
    }
    
    /* КАРТИНКА ЗАНИМАЕТ МАКСИМУМ МЕСТА */
    #large-images-table td img {
        max-height: 115px !important;
        max-width: 100% !important; /* На всю доступную ширину */
    }
    
    #large-images-table td > div:nth-child(2) {
        padding: 12px 10px !important;
        min-height: 65px !important;
        border-radius: 0 0 10px 10px !important;
    }
    
    #large-images-table td > div:nth-child(2) a {
        font-size: 14px !important;
    }
}

/* Мобильные (576px) - ОДНА КОЛОНКА, КОМПАКТНО */
@media (max-width: 576px) {
    #large-images-table tbody {
        grid-template-columns: 1fr !important;
        max-width: 320px !important; /* Уже чем было */
        margin: 0 auto !important;
        gap: 12px !important;
    }
    
    #large-images-table td {
        min-height: 210px !important; /* Еще компактнее */
    }
    
    /* МИНИМАЛЬНЫЕ ОТСТУПЫ, МАКСИМАЛЬНАЯ КАРТИНКА */
    #large-images-table td > div:first-child {
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
        padding: 10px 8px !important; /* Очень маленькие отступы */
    }
    
    /* КАРТИНКА ЗАНИМАЕТ 90% ВЫСОТЫ КОНТЕЙНЕРА */
    #large-images-table td img {
        max-height: 110px !important; /* Больше относительно контейнера */
        max-width: 100% !important;
    }
    
    #large-images-table td > div:nth-child(2) {
        padding: 10px 8px !important;
        min-height: 60px !important;
    }
    
    #large-images-table td > div:nth-child(2) a {
        font-size: 13px !important;
        padding: 0 5px !important; /* Отступы только по бокам */
    }
}

/* Очень маленькие экраны (420px) - супер компактно */
@media (max-width: 420px) {
    #large-images-table tbody {
        max-width: 300px !important;
        gap: 10px !important;
    }
    
    #large-images-table td {
        min-height: 190px !important;
        border-radius: 8px !important;
    }
    
    /* СОВСЕМ МАЛО ПУСТОГО ПРОСТРАНСТВА */
    #large-images-table td > div:first-child {
        height: 125px !important;
        min-height: 125px !important;
        max-height: 125px !important;
        padding: 8px 6px !important; /* Минимальные отступы */
        border-radius: 8px 8px 0 0 !important;
    }
    
    /* КАРТИНКА ПОЧТИ НА ВЕСЬ КОНТЕЙНЕР */
    #large-images-table td img {
        max-height: 100px !important; /* Занимает ~80% высоты контейнера */
        max-width: 100% !important;
    }
    
    #large-images-table td > div:nth-child(2) {
        padding: 8px 6px !important;
        min-height: 55px !important;
        border-radius: 0 0 8px 8px !important;
    }
    
    #large-images-table td > div:nth-child(2) a {
        font-size: 12px !important;
        line-height: 1.2 !important;
        padding: 0 !important;
    }
}

/* Экстремально маленькие экраны (360px) */
@media (max-width: 360px) {
    #large-images-table tbody {
        max-width: 280px !important;
        gap: 8px !important;
    }
    
    #large-images-table td {
        min-height: 180px !important;
    }
    
    #large-images-table td > div:first-child {
        height: 115px !important;
        min-height: 115px !important;
        max-height: 115px !important;
        padding: 6px 5px !important;
    }
    
    #large-images-table td img {
        max-height: 95px !important;
    }
    
    #large-images-table td > div:nth-child(2) {
        padding: 6px 5px !important;
        min-height: 50px !important;
    }
    
    #large-images-table td > div:nth-child(2) a {
        font-size: 11px !important;
    }
}
/* Убираем outline при клике мышью, но сохраняем при Tab */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
td:focus:not(:focus-visible) {
    outline: none !important;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid #007bff !important;
    outline-offset: 2px !important;
}