/* Горизонтальный скролл для таблицы в адаптивном дизайне */
section[name=terminal] .terminal .statistics {
    grid-template-columns: repeat(auto-fit, minmax(270px, 212px)) ;
}
.wrapper.admin .modal .modal__content .btn.modal__btn.btn--add{
max-width: 100% !important;
}
/* Стили для меню только на средних экранах (481px - 1240px) */
@media screen and (max-width: 1240px) and (min-width: 481px) {

    /* Скрываем гамбургер на средних экранах, где меню видно */
    .drawler {
        display: none !important;
    }

    /* Фиксируем меню и сохраняем его ширину */
    .nav {
        top: 0 !important;
        left: 0 !important;
        z-index: 1000 !important;
        transform: none !important;
        margin-left: 0 !important;
        overflow: visible !important;
    }

    /* Workspace со сдвигом вправо, чтобы не перекрывался меню */
    .workspace {
        overflow-x: hidden;
        max-width: calc(100%);
        width: calc(100%);
    }
}

/* Общие стили для всех адаптивных экранов */
@media screen and (max-width: 1240px) {

    /* Блокируем горизонтальный скролл страницы */
    html,
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .wrapper {
        max-width: 100vw;
    }

    /* Убираем боковые отступы у section */
    section[name=terminal] {
        padding: 0 10px !important;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Ограничиваем ширину родительских контейнеров */
    .workspace__content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .terminal.partners.partners-card {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .terminals-table {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        padding: 20px 15px 40px !important;
        /* Уменьшаем боковые отступы */
    }

    /* Ограничиваем ширину row и колонок */
    .terminals-table .row {
        max-width: 100%;
        overflow-x: hidden;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .terminals-table .col-md-12 {
        max-width: 100%;
        overflow-x: hidden;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Отменяем преобразование thead в flex */
    .table__thead {
        display: table-header-group !important;
    }

    /* Отменяем преобразование tbody в flex */
    .table__tbody {
        display: table-row-group !important;
    }

    /* Возвращаем стандартное отображение строк */
    .table-row {
        display: table-row !important;
        width: auto !important;
        flex-direction: initial !important;
        align-items: initial !important;
        justify-content: initial !important;
        border: initial !important;
        min-width: initial !important;
    }

    .workspace__header {
        justify-content: space-around !important;
    }

    /* Возвращаем стандартное отображение ячеек */
    .table-row__td {
        display: table-cell !important;
        text-align: left !important;
        padding: 12px !important;
        white-space: nowrap;
    }

    /* Последняя колонка (действия) - разрешаем перенос и добавляем отступ */
    .table-row__td:last-child {
        white-space: normal !important;
        min-width: 120px !important;
        padding-right: 60px !important;
        width: 10% !important;
    }

    .table__th:last-child {
        min-width: 120px !important;
        padding-right: 60px !important;
    }

    /* Убираем метки data-column */
    .table-row__td:before {
        content: none !important;
    }

    /* Добавляем горизонтальный скролл для контейнера таблицы */
    .table-container {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        display: block;
        padding-right: 0;
        /* Убираем padding, он мешает */
        box-sizing: border-box;
    }

    /* Добавляем wrapper для таблицы с отступом */
    .table-container::after {
        content: '';
        display: block;
        width: 50px;
        height: 1px;
    }

    /* Визуальная подсказка о возможности скролла */
    .table-container::-webkit-scrollbar {
        height: 8px;
    }

    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #129a97;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb:hover {
        background: #0d7774;
    }

    /* Устанавливаем минимальную ширину для таблицы */
    .table {
        min-width: 1400px;
        /* Максимально увеличили */
        width: max-content;
        border-collapse: collapse;
        margin: 0;
        margin-right: 50px;
        /* Добавляем отступ справа через margin */
    }

    /* Возвращаем нормальное отображение для table-row__img */
    .table-row__img {
        width: auto;
        height: auto;
        margin-bottom: 0;
        display: inline-block;
        vertical-align: middle;
    }

    .workspace__content.filters-system .terminal-select.terminal-select--filters {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .workspace__content.filters-system .terminal-select.terminal-select--filters .chart__btn.btn {
        width: 55% !important;
    }

    .workspace__content.filters-system .terminal-select.terminal-select--filters select {
        margin-left: 0px !important;
        width: 55% !important;

    }

    /* Возвращаем нормальное отображение для table-row__info */
    .table-row__info {
        display: inline-block;
        padding-left: 10px;
    }

    .table-row__td.table-row__td--left {
        text-align: left !important;
    }

    .table-row__td.table-row__td--left .table-row__info {
        padding-left: 0;
    }

    .filters-system__buttons {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .workspace__content.filters-system .terminal-select {
        justify-content: space-around !important;
    }
}

@media screen and (max-width: 990px) {
    section[name=terminal] .terminal .statistics {
        grid-template-columns: repeat(auto-fit, minmax(195px, 100%));
    }

    .statistics {
        grid-template-columns: repeat(auto-fit, minmax(260px, 100%)) !important;
    }

    section[name=terminal] .terminal .statistics__info {
        width: 100% !important;

    }

    .statistics__img img {
        width: 26px !important;
    }
   

    section[name=analytic] .analytic .chart__controls ,section[name=analytic] .analytic .chart__controls input {
        width: 100% !important;
    }
    .terminal.finances .terminal-info__control.terminal-info__control--transactions select {
        width: 100% !important;
    }
    .finances-wrapper .terminal-info__control.terminal-info__control--transactions{
        width: 100% !important;
    }
    section[name=terminal] .terminal-info__control--transactions input {
        width: 100% !important;
    }
    section[name=user] .user .inputs-wrapper input{
        width: 100% !important;
        text-align: center !important;
    }
    section[name=user] .user__btn {
        width: 100% !important;
        text-align: center !important;
    }
}

@media screen and (max-width: 680px) {
    .table-row {
        width: auto !important;
    }

    .workspace__content.filters-system .terminal-select {
        flex-direction: column !important;
        gap: 20px !important;
    }

    .workspace__content.filters-system .terminal-select.terminal-select--filters select {
        margin-left: 0px !important;
        width: 100% !important;
    }

    .workspace .user-info__email{
        display: none !important;
    }
    .workspace .user-info{
        background-color: transparent !important;
    }
    .workspace__header{
        flex-direction: row !important;
        justify-content: space-around !important;
    }
    section[name=terminal] .terminal-select select {
        width: 100% !important;
        border-radius: 5px;
        border: 1px solid #dfdfdf;
        padding: 8px !important;
    }
    .workspace .user-info svg{
        width: 50px;
        height: 50px;
    }
    section[name=analytic] .analytic .chart__controls ,section[name=analytic] .analytic .chart__controls input {
        width: 100% !important;
    }

    .finances-wrapper .terminal-info__control.terminal-info__control--transactions{
        width: 100% !important;
    }
    .login-form{
        width: 85% !important;
        border-radius: 40px !important;
    }
    section[name=terminal] .terminal-info__control--transactions input {
        width: 100% !important;
    }
    section[name=terminal] .terminal-list {
        justify-content: center !important;
    }
    section[name="terminal"] .filters3-block{
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    section[name="terminal"] .filters3-block a {
        width: 100% !important;
    }
    section[name=terminal] .terminal-info__control--transactions{
        width: 100% !important;
    }
    .terminal.partners.partners-card .pagination-wrapper{
        margin-bottom: 50px !important;
    }
    .workspace__title.notifications-title {
        align-items: center !important;
    }
    .filters-system__buttons {
        width: 100% !important;
    }
    .workspace__content.filters-system .terminal-select a.btn.btn--add{
        width: 100% !important;
        max-width: 100% !important;
        height: 41px;
    }
    .workspace__content.filters-system .terminal-select.terminal-select--filters .chart__btn.btn{
        width: 100% !important;
    }
    .table__tbody .table-row__td .partners-control form button{
        width: 35px !important;
    }
    .partners-control a img{
        width: 35px !important;
    }
    .workspace__title.partners-title{
        column-gap: 6px !important;
        
    }
}
    @media screen and (max-width: 480px) {

        /* На маленьких экранах НЕ трогаем меню, пусть работает как раньше */
        /* Отменяем сдвиг контента */
        .workspace {
            margin-left: 0 !important;
            max-width: 100% !important;
            width: 100% !important;
            height: 100% !important;
        }

        /* ВАЖНО: Разрешаем скролл для родительских контейнеров таблицы */
        .workspace__content,
        .terminal.partners.partners-card,
        .terminals-table,
        .terminals-table .row,
        .terminals-table .col-md-12 {
            overflow-x: visible !important;
        }

        section[name=terminal] {
            overflow-x: visible !important;
        }

        /* Уменьшаем огромные отступы для мобильных */
        .table {
            min-width: 900px !important;
            /* Уменьшаем ширину */
            margin-right: 10px !important;
            /* Уменьшаем margin */
        }

        .table-row__td:last-child {
            padding-right: 15px !important;
            /* Уменьшаем padding */
            min-width: 60px !important;
        }

        .table__th:last-child {
            padding-right: 15px !important;
            min-width: 60px !important;
        }

        /* Уменьшаем отступы на мобильных */
        section[name=terminal] {
            padding: 0 5px !important;
        }

        .terminals-table {
            padding: 1px 5px 30px !important;
        }

        .table-row {
            width: auto !important;
        }

        /* Уменьшаем padding для ячеек на маленьких экранах */
        .table-row__td {
            padding: 6px !important;
            font-size: 12px;
        }

        .table-row__name {
            font-size: 15px !important;
        }

        .table-row__small {
            font-size: 10px !important;
        }

        .table-row__policy {
            font-size: 12px !important;
        }

        /* Уменьшаем иконку статуса */
        .table-row__img svg,
        .table-row__img img {
            width: 30px;
        }

        /* Настройка скроллбара для маленьких экранов */
        .table-container::-webkit-scrollbar {
            height: 6px;
        }
    }