/* ============================================================
   GAMECS / AMXBans - Responsive Override
   Carregar APOS style.css e facebox.css.
   Preserva o tema Dark no desktop; adapta telas <= 767px.
   ============================================================ */

/* Evita que padding e bordas aumentem a largura dos elementos. */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Imagens só são limitadas no mobile.
   No desktop, max-width:100% podia encolher sprites/ícones do AMXBans
   dentro de células estreitas da ban_list. */

/* Desktop: preserva exatamente o tamanho nativo dos sprites do AMXBans. */
@media screen and (min-width: 768px) {
    .icons-stats { width: 16px !important; height: 16px !important; max-width: none !important; }
    .icons-func  { width: 15px !important; height: 17px !important; max-width: none !important; }
    .icons-connect { width: 80px !important; height: 15px !important; max-width: none !important; }
    .icons-page  { width: 16px !important; height: 16px !important; max-width: none !important; }
    .icon-access { width: 16px !important; height: 16px !important; max-width: none !important; }
}

/* Celulares e telas de até 767px. */
@media screen and (max-width: 767px) {
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }

    /* Sprites/ícones do AMXBans não devem ser redimensionados pelo max-width global. */
    .icons-stats, .icons-func, .icons-connect, .icons-page, .icon-access {
        max-width: none !important;
        flex-shrink: 0;
    }

    html, body {
        max-width: 100%;
    }

    .center-wrapper {
        width: auto !important;
        max-width: 980px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 14px;
        padding-right: 14px;
    }

    #header, #navigation, #network, #toolbar, #footer,
    .main, .section, .section-content, #dashboard {
        max-width: 100%;
    }

    /* Remove as larguras fixas das duas variantes de layout. */
    .main#main-three-columns .sidebar,
    .main#main-three-columns #main-left,
    .main#main-two-columns .sidebar,
    .main#main-two-columns #main-left,
    .main#main-two-columns .sidebar-50-50,
    .main#main-two-columns #main-left-50-50 {
        width: auto !important;
        max-width: 100%;
    }

    /* Tabelas largas: preserva todas as colunas, com rolagem horizontal. */
    .main > table,
    .section-content > table,
    table.data-table,
    table.admin_list {
        display: block;
        width: 100% !important;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main > table th,
    .main > table td,
    .section-content > table th,
    .section-content > table td,
    table.data-table th,
    table.data-table td,
    table.admin_list th,
    table.admin_list td {
        overflow-wrap: anywhere;
    }

    /* Formulários não podem ultrapassar a largura da tela. */
    input, select, textarea, button, fieldset {
        max-width: 100%;
    }

    textarea {
        width: 100%;
    }

    pre, code {
        overflow-wrap: anywhere;
    }

    pre {
        white-space: pre-wrap;
    }

    /* Modal Facebox: mantém o JS de abertura, mas limita a largura. */
    #facebox {
        left: 50% !important;
        width: calc(100vw - 24px) !important;
        max-width: 540px;
        transform: translateX(-50%);
    }

    #facebox .popup {
        width: 100% !important;
        max-width: 100%;
    }

    #facebox .body {
        width: auto !important;
        max-width: 100%;
        overflow-wrap: anywhere;
        overflow-x: auto;
    }

    #facebox .body img {
        max-width: 100%;
        height: auto;
    }
}

/* Celulares e tablets estreitos: colunas empilhadas e menus fluidos. */
@media screen and (max-width: 767px) {
    .center-wrapper {
        padding-left: 10px;
        padding-right: 10px;
    }

    #header, #network, #navigation, #toolbar, #footer,
    .main, #sidebar-wrapper, #sidebar, #main-left,
    #main-left-50-50, .sidebar, .sidebar-50-50,
    .col3, .col3-mid, #dashboard .column {
        float: none !important;
        clear: both;
        width: 100% !important;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    #sidebar-1 {
        margin-left: 0 !important;
    }

    .main#main-three-columns .sidebar,
    .main#main-three-columns #main-left,
    .main#main-two-columns .sidebar,
    .main#main-two-columns #main-left,
    .main#main-two-columns .sidebar-50-50,
    .main#main-two-columns #main-left-50-50 {
        float: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Menu antigo usa itens flutuantes. Permite várias linhas. */
    #network .tabbed,
    #navigation .tabbed,
    #main-nav,
    #sub-nav {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 4px;
        max-width: 100%;
    }

    #network .tabbed li,
    #navigation .tabbed li,
    #main-nav li,
    #sub-nav li {
        float: none !important;
        max-width: 100%;
        list-style: none;
    }

    #network .tabbed a,
    #main-nav a,
    #sub-nav a {
        padding: 9px 11px;
        font-size: 13px;
        line-height: 1.4;
    }

    #toolbar .left,
    #toolbar .right,
    #footer .left,
    #footer .right,
    #network > .left,
    #network > .right {
        float: none !important;
        display: block;
        width: 100%;
        margin: 4px 0;
    }

    .section, fieldset, #dashboard, .main_error {
        padding: 10px !important;
    }

    .section-content {
        padding: 8px;
    }

    .main > table th,
    .main > table td,
    .section-content > table th,
    .section-content > table td,
    table.data-table th,
    table.data-table td {
        padding: 7px 8px;
        font-size: 12px;
    }

    /* Formulários: áreas de digitação confortáveis no toque. */
    input.text, input[type="text"], input[type="password"],
    input[type="email"], input[type="search"], select, textarea {
        max-width: 100%;
        font-size: 16px;
    }

    input.button, input[type="submit"], button {
        min-height: 36px;
    }

    /* Paginação flutuante do AMXBans. */
    .pager {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        max-width: 100%;
    }

    .pager a, .pager span {
        float: none !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 32px;
        height: auto;
        line-height: 1.2;
        margin: 0;
        padding: 6px 9px;
    }

    #facebox {
        width: calc(100vw - 16px) !important;
    }

    #facebox .body {
        padding: 10px !important;
    }
}

@media screen and (max-width: 380px) {
    .center-wrapper {
        padding-left: 7px;
        padding-right: 7px;
    }

    #network .tabbed a,
    #main-nav a,
    #sub-nav a {
        padding: 8px;
        font-size: 12px;
    }
}


/* ============================================================
   GAMECS / AMXBans - v3: menus completos + tabelas com scroll
   ============================================================ */
@media screen and (max-width: 767px) {
    html, body { max-width: 100%; overflow-x: hidden; }

    /* O menu real tem DOIS blocos: #menu-tabs e #admin-tabs.
       Cada bloco tem sua propria rolagem: nenhum link e ocultado. */
    #network .center-wrapper { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    #network .center-wrapper > .left,
    #network .center-wrapper > .right {
        float: none !important;
        clear: none !important;
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    #network .center-wrapper > .clearer { display: none !important; }
    #network #menu-tabs,
    #network #admin-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        width: max-content !important;
        min-width: 100%;
        max-width: none !important;
        gap: 3px;
        padding: 3px 0 8px;
        margin: 0;
        list-style: none;
    }
    #network #menu-tabs li,
    #network #admin-tabs li {
        display: block;
        float: none !important;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    #network #menu-tabs a,
    #network #admin-tabs a {
        display: block;
        padding: 8px 11px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }
    #network #admin-tabs form { white-space: nowrap; padding: 3px 0; }
    #network #admin-tabs input[type="text"],
    #network #admin-tabs input[type="password"] {
        width: 125px;
        min-width: 0;
    }

    /* Scroll da tabela DENTRO do post, sem deslocar a pagina inteira.
       Os wrappers sao adicionados nos .tpl disponibilizados. */
    .gamecs-table-scroll {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .gamecs-table-scroll > table {
        display: table !important;
        width: max-content !important;
        min-width: 100%;
        max-width: none !important;
        overflow: visible !important;
        border-collapse: collapse;
    }
    .gamecs-table-scroll > table th,
    .gamecs-table-scroll > table td {
        white-space: nowrap !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
        padding: 8px 10px !important;
    }
    /* A tabela de detalhes interna conserva a estrutura original. */
    .gamecs-table-scroll table table { display: table !important; }

}

/* =========================================================
   GAMECS / AMXBANS — ADMIN LIST MOBILE
   ========================================================= */

@media screen and (max-width: 767px) {

    /* Impede que o conteúdo principal ultrapasse a tela */
    .center-wrapper,
    .main,
    #main-left,
    #main-three-columns,
    #main-two-columns {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Área responsável pela rolagem horizontal */
    .admin-list-scroll {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    /* Mantém a tabela em sua largura natural */
    .admin-list-scroll > table {
        width: max-content !important;
        min-width: 850px !important;
        table-layout: auto !important;
    }

    /* Não comprime SteamID, nickname e datas */
    .admin-list-scroll th,
    .admin-list-scroll td {
        white-space: nowrap !important;
    }

}
/* Admin list: wrapper real presente no admin_list_corrigido.tpl */
@media screen and (max-width: 767px) {
  .main .post { min-width: 0; max-width: 100%; }
  .main .post > .admin-list-scroll {
    display: block !important; width: 100% !important; max-width: 100% !important;
    overflow-x: auto !important; overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y;
  }
  .main .post > .admin-list-scroll > table {
    display: table !important; width: max-content !important;
    min-width: 850px !important; max-width: none !important;
    table-layout: auto !important; overflow: visible !important;
  }
  .main .post > .admin-list-scroll > table th,
  .main .post > .admin-list-scroll > table td {
    white-space: nowrap !important; overflow-wrap: normal !important;
    word-break: normal !important;
  }
}

/* =========================================================
   GAMECS / AMXBANS — AJAX DETAILS (ADMIN / MOD / VIP)
   Corrige banners + icones sem alargar o modal.
   ========================================================= */
#facebox .body {
    width: 430px !important;
    max-width: calc(100vw - 36px) !important;
    overflow-x: hidden !important;
}
#facebox .gamecs-ajax-details,
#facebox .gamecs-ajax-signature,
#facebox .gamecs-ajax-servers {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
}
#facebox .gamecs-ajax-details td {
    overflow-wrap: anywhere;
    white-space: normal !important;
}
#facebox .gamecs-ajax-signature img {
    display: block;
    max-width: 100% !important;
    height: auto !important;
}
#facebox .gamecs-ajax-servers td {
    width: 100% !important;
    max-width: 100%;
}
#facebox .gamecs-server-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    margin: 0 0 5px;
}
#facebox .gamecs-server-banner-link {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}
#facebox .gamecs-server-banner {
    display: block;
    width: 100% !important;
    max-width: 350px !important;
    height: auto !important;
}
#facebox .gamecs-server-icon-link {
    display: block;
    flex: 0 0 20px;
    width: 20px;
}
#facebox .gamecs-server-icon {
    display: block;
    width: 20px !important;
    height: 20px !important;
    max-width: none !important;
}
@media screen and (max-width: 767px) {
    #facebox {
        width: calc(100vw - 16px) !important;
        max-width: none !important;
    }
    #facebox .popup {
        width: 100% !important;
        max-width: 100% !important;
    }
    #facebox .body {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
    }
    #facebox .gamecs-ajax-details td:first-child {
        width: 42% !important;
    }
    #facebox .gamecs-ajax-details td:last-child {
        overflow-wrap: anywhere !important;
    }
}

/* =========================================================
   GAMECS / AMXBANS — SERVIDORES NO FACEBOX MOBILE
   ========================================================= */

@media screen and (max-width: 767px) {

    /* Cada servidor: banner + ícones na mesma linha */
    #facebox .gamecs-server-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 5px !important;
        width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 8px !important;
    }

    /* Área do banner */
    #facebox .gamecs-server-row > a:first-child {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    /* Banner reduzido proporcionalmente */
    #facebox .gamecs-server-banner {
        display: block !important;
        width: 100% !important;
        max-width: 350px !important;
        height: auto !important;
    }

    /* Links dos ícones */
    #facebox .gamecs-server-row > a:not(:first-child) {
        flex: 0 0 20px !important;
    }

    /* Ícones Steam e HLSW */
    #facebox .gamecs-server-icon {
        display: block !important;
        width: 20px !important;
        height: 20px !important;
        max-width: none !important;
    }

}

/* GameCS - ban list: rolagem apenas na tabela principal */
@media screen and (max-width: 767px) {
  .gamecs-ban-scroll {display:block; width:100%; max-width:100%; min-width:0; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;}
  .gamecs-ban-scroll > table {display:table !important; width:max-content !important; min-width:850px !important; table-layout:auto !important;}
  .gamecs-ban-scroll > table > thead, .gamecs-ban-scroll > table > tbody {display:table-row-group;}
  .gamecs-ban-scroll > table > thead {display:table-header-group;}
  .gamecs-ban-scroll > table > tbody > tr, .gamecs-ban-scroll > table > thead > tr {display:table-row !important;}
  .gamecs-ban-scroll > table > tbody > tr > td, .gamecs-ban-scroll > table > thead > tr > th {display:table-cell !important; white-space:nowrap;}
  .gamecs-ban-scroll .server-info {white-space:normal !important;}
}

/* GameCS / AMXBans — perfil Steam e adicionar amigo, desktop e mobile.
   O admin_list.tpl usa uma célula inicial de apenas 35px; os dois
   ícones não cabem nessa largura e quebram em linhas separadas. */
.admin-list-scroll > table > tbody > tr > td:first-child {
    min-width: 48px !important;
    width: 48px !important;
    white-space: nowrap !important;
    vertical-align: middle;
}
.admin-list-scroll > table > tbody > tr > td:first-child > a {
    display: inline-block !important;
    float: none !important;
    vertical-align: middle !important;
    margin: 0 2px 0 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.admin-list-scroll > table > tbody > tr > td:first-child > a > img {
    display: inline-block !important;
    vertical-align: middle !important;
    max-width: none !important;
}
