/* ============================================================================
   TELA DE PRODUTOS
   ----------------------------------------------------------------------------
   Este arquivo contém somente os estilos específicos da tela Produtos.
   O menu, cores globais e componentes compartilhados continuam em style.css.
   ============================================================================ */

.products-wrap {
    width: 100%;
    max-width: 1510px;
    margin: 0 auto;
    padding: 24px 0 40px;
}

/* --------------------------------------------------------------------------
   Cabeçalho
   -------------------------------------------------------------------------- */
.products-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.eyebrow {
    color: #ffbd00;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    margin-bottom: 7px;
}

.products-heading h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.products-heading p {
    margin: 7px 0 0;
    color: #8f99a3;
    font-size: 13px;
}

.btn-primary {
    min-height: 44px;
    padding: 0 17px;
    border: 1px solid #ffbd00;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffc51e, #ffad00);
    color: #111;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Cards de resumo
   -------------------------------------------------------------------------- */
.product-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.summary-card {
    min-height: 92px;
    padding: 16px 18px;
    border: 1px solid #252c32;
    border-radius: 14px;
    background: linear-gradient(145deg, #151a1f, #0f1317);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}

.summary-card span {
    display: block;
    color: #8f99a3;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    color: #f4f6f8;
    font-size: 25px;
    line-height: 1;
}

.summary-ok strong { color: #55c75c; }
.summary-low strong { color: #ffb400; }
.summary-neg strong { color: #ff3835; }

/* --------------------------------------------------------------------------
   Painel principal
   -------------------------------------------------------------------------- */
.products-panel {
    overflow: hidden;
    border: 1px solid #252c32;
    border-radius: 16px;
    background: linear-gradient(145deg, #12171b, #0d1114);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .20);
}

.products-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px 170px;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid #252c32;
    background: rgba(5, 7, 9, .55);
}

.search-box,
.filter-select {
    min-height: 46px;
    border: 1px solid #30373e;
    border-radius: 10px;
    background: #090d10;
    color: #eef1f4;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
}

.search-box span {
    color: #aeb7c0;
    font-size: 23px;
    line-height: 1;
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f4f6f8;
    font: inherit;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #737d87;
}

.filter-select {
    width: 100%;
    padding: 0 12px;
    outline: 0;
    cursor: pointer;
}

.search-box:focus-within,
.filter-select:focus {
    border-color: #b88700;
    box-shadow: 0 0 0 3px rgba(255, 189, 0, .08);
}

.products-status {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: #89939d;
    font-size: 11px;
}

.products-status.error {
    color: #ff7773;
}

/* --------------------------------------------------------------------------
   Tabela
   -------------------------------------------------------------------------- */
.products-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.products-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    table-layout: fixed;
}

.products-table th {
    padding: 12px 14px;
    border-bottom: 1px solid #30373e;
    background: #181d22;
    color: #8f99a3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: left;
}

.products-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #252c32;
    color: #e8ebee;
    font-size: 12px;
    vertical-align: middle;
}

.products-table tbody tr {
    transition: background .15s ease;
}

.products-table tbody tr:hover {
    background: rgba(255, 189, 0, .035);
}

.products-table tbody tr:last-child td {
    border-bottom: 0;
}

.col-code { width: 80px; }
.col-name { width: auto; }
.col-unit { width: 62px; }
.col-number { width: 90px; }
.col-money { width: 100px; }
.col-margin { width: 95px; }
.col-status { width: 145px; }

.code {
    color: #f4f6f8;
    font-weight: 800;
}

.product-name {
    color: #f4f6f8;
    font-weight: 600;
}

.number {
    font-variant-numeric: tabular-nums;
}

.money {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.margin-positive {
    color: #69d672;
    font-weight: 700;
}

.margin-negative {
    color: #ff7773;
    font-weight: 700;
}

.stock-negative {
    color: #ff3835;
    font-weight: 800;
}

.stock-low {
    color: #ffb400;
    font-weight: 800;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .03em;
    white-space: nowrap;
}

.status.ok {
    color: #72dc79;
    background: #153c1d;
}

.status.low {
    color: #ffc52c;
    background: #4b3b0c;
}

.status.neg {
    color: #ff7773;
    background: #4b1716;
}

/* --------------------------------------------------------------------------
   Paginação
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    padding: 14px 16px 16px;
    border-top: 1px solid #252c32;
}

.page-btn {
    min-width: 34px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid #30373e;
    border-radius: 7px;
    background: #0c1013;
    color: #b9c0c7;
    cursor: pointer;
}

.page-btn:hover:not(:disabled) {
    border-color: #80650b;
    color: #fff;
}

.page-btn.active {
    border-color: #ffbd00;
    background: rgba(255, 189, 0, .08);
    color: #ffbd00;
}

.page-btn:disabled {
    opacity: .35;
    cursor: default;
}

.page-ellipsis {
    padding: 0 4px;
    color: #6f7880;
}

/* ============================================================================
   MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    .products-wrap {
        padding: 18px 0 30px;
    }

    .products-heading {
        align-items: flex-start;
        margin-bottom: 14px;
    }

    .products-heading h1 {
        font-size: 25px;
    }

    .products-heading p {
        font-size: 12px;
        max-width: 270px;
    }

    .btn-primary {
        min-height: 42px;
        padding: 0 13px;
        font-size: 12px;
    }

    .product-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .summary-card {
        min-height: 82px;
        padding: 13px 14px;
    }

    .summary-card strong {
        font-size: 22px;
    }

    .products-toolbar {
        grid-template-columns: minmax(0, 1fr) 150px;
        gap: 8px;
        padding: 12px;
    }

    .search-box {
        grid-column: 1 / -1;
    }

    .page-size {
        grid-column: 1 / -1;
    }

    .products-status {
        min-height: 34px;
        padding: 0 12px;
    }

    /*
       No celular mantemos a tabela como lista horizontal compacta.
       Assim os campos continuam alinhados como no computador e o usuário
       pode deslizar lateralmente para ver custo, venda e margem.
    */
    .products-table {
        min-width: 820px;
    }

    .products-table th,
    .products-table td {
        padding: 11px 10px;
        font-size: 11px;
    }

    .products-table th {
        font-size: 9px;
    }

    .product-name {
        font-size: 11px;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        padding: 12px;
    }
}

@media (max-width: 430px) {
    .products-heading {
        gap: 10px;
    }

    .products-heading h1 {
        font-size: 23px;
    }

    .products-heading p {
        display: none;
    }

    .btn-primary {
        font-size: 11px;
        padding: 0 11px;
    }

    .product-summary {
        gap: 7px;
    }

    .summary-card {
        min-height: 76px;
        padding: 11px 12px;
    }

    .summary-card span {
        font-size: 9px;
    }

    .summary-card strong {
        font-size: 20px;
    }
}

/* Mensagens de estado da tabela */
.products-empty-cell,
.products-error-cell {
    padding: 42px 20px !important;
    text-align: center;
    color: #8f99a3 !important;
}

.products-error-cell {
    color: #ff7773 !important;
}

/* ============================================================================
   AJUSTE FINAL — TELA DE PRODUTOS NO CELULAR
   ----------------------------------------------------------------------------
   O desktop permanece intacto.

   No celular:
   - o menu lateral continua escondido e abre pelo botão ☰;
   - os indicadores ficam em 2 colunas;
   - a pesquisa ocupa toda a largura;
   - a lista continua sendo uma tabela, igual à versão desktop;
   - a tabela fica compacta e pode ser deslizada horizontalmente;
   - nenhum campo é transformado em card ou quebrado em linhas diferentes.
   ============================================================================ */

@media (max-width: 768px) {
    .products-wrap {
        width: 100%;
        max-width: none;
        padding: 18px 0 28px;
    }

    /* ------------------------------------------------------------------------
       Cabeçalho da tela
       ------------------------------------------------------------------------ */
    .products-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 16px;
    }

    .products-heading h1 {
        font-size: 25px;
        line-height: 1.1;
    }

    .products-heading p {
        margin-top: 6px;
        font-size: 11px;
        line-height: 1.35;
        max-width: 235px;
    }

    .eyebrow {
        margin-bottom: 5px;
        font-size: 9px;
    }

    .btn-primary {
        min-height: 42px;
        padding: 0 13px;
        border-radius: 9px;
        font-size: 11px;
        flex: 0 0 auto;
    }

    /* ------------------------------------------------------------------------
       Resumo
       ------------------------------------------------------------------------ */
    .product-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 12px;
    }

    .summary-card {
        min-height: 76px;
        padding: 12px 13px;
        border-radius: 12px;
    }

    .summary-card span {
        font-size: 8px;
        letter-spacing: .07em;
    }

    .summary-card strong {
        margin-top: 7px;
        font-size: 21px;
    }

    /* ------------------------------------------------------------------------
       Painel de consulta
       ------------------------------------------------------------------------ */
    .products-panel {
        width: 100%;
        border-radius: 13px;
    }

    .products-toolbar {
        grid-template-columns: minmax(0, 1fr) minmax(115px, .42fr);
        gap: 8px;
        padding: 11px;
    }

    .search-box {
        grid-column: 1 / -1;
        min-height: 46px;
        padding: 0 11px;
        border-radius: 9px;
    }

    .search-box span {
        font-size: 20px;
    }

    .search-box input {
        font-size: 13px;
    }

    .filter-select {
        min-height: 44px;
        height: 44px;
        padding: 0 9px;
        border-radius: 9px;
        font-size: 11px;
    }

    .page-size {
        grid-column: auto;
    }

    .products-status {
        min-height: 32px;
        padding: 0 11px;
        font-size: 10px;
    }

    /* ------------------------------------------------------------------------
       Tabela/lista
       ------------------------------------------------------------------------
       A tabela não vira card.
       Ela conserva a mesma ordem dos campos do desktop e recebe somente
       uma largura mínima para que todos os dados continuem alinhados.
       ------------------------------------------------------------------------ */
    .products-table-wrap {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        overscroll-behavior-x: contain;
        border-top: 1px solid #252c32;
    }

    .products-table {
        width: 760px;
        min-width: 760px;
        table-layout: fixed;
        border-collapse: collapse;
    }

    .products-table th,
    .products-table td {
        box-sizing: border-box;
        white-space: nowrap;
    }

    .products-table th {
        height: 40px;
        padding: 9px 8px;
        font-size: 8px;
        letter-spacing: .055em;
    }

    .products-table td {
        height: 47px;
        padding: 9px 8px;
        font-size: 10px;
    }

    /* Larguras proporcionais à importância de cada informação. */
    .products-table .col-code {
        width: 58px;
    }

    .products-table .col-name {
        width: 250px;
    }

    .products-table .col-unit {
        width: 48px;
    }

    .products-table .col-number {
        width: 68px;
    }

    .products-table .col-money {
        width: 83px;
    }

    .products-table .col-margin {
        width: 72px;
    }

    .products-table .col-status {
        width: 130px;
    }

    .products-table td.product-name {
        max-width: 250px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 10px;
        font-weight: 600;
    }

    .products-table td.code {
        font-size: 10px;
        font-weight: 800;
    }

    .products-table td.number,
    .products-table td.money,
    .products-table td.margin-positive,
    .products-table td.margin-negative {
        font-size: 10px;
        font-variant-numeric: tabular-nums;
    }

    .products-table td:nth-child(3) {
        text-align: center;
    }

    .products-table td:nth-child(4),
    .products-table td:nth-child(5),
    .products-table td:nth-child(6),
    .products-table td:nth-child(7),
    .products-table td:nth-child(8) {
        text-align: right;
    }

    .products-table td:nth-child(9) {
        text-align: center;
    }

    .products-table .status {
        min-width: 82px;
        padding: 5px 7px;
        font-size: 7px;
    }

    /* Indica visualmente que existe conteúdo além da borda direita. */
    .products-table-wrap::after {
        content: 'Deslize para ver mais →';
        position: sticky;
        left: calc(100% - 150px);
        display: block;
        width: max-content;
        margin-top: -24px;
        margin-left: calc(100% - 151px);
        padding: 5px 8px;
        border-radius: 6px 0 0 0;
        background: rgba(8, 10, 13, .86);
        color: #737d87;
        font-size: 8px;
        pointer-events: none;
    }

    /* Estados vazios/erro não precisam respeitar a largura normal da tabela. */
    .products-empty-cell,
    .products-error-cell {
        height: 90px !important;
        padding: 20px !important;
        text-align: center !important;
        white-space: normal !important;
    }

    /* ------------------------------------------------------------------------
       Paginação
       ------------------------------------------------------------------------ */
    .pagination {
        justify-content: center;
        gap: 4px;
        padding: 10px 9px 12px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .page-btn {
        min-width: 31px;
        height: 31px;
        font-size: 11px;
    }
}

@media (max-width: 430px) {
    .products-wrap {
        padding-top: 15px;
    }

    .products-heading {
        gap: 8px;
    }

    .products-heading h1 {
        font-size: 23px;
    }

    .products-heading p {
        max-width: 210px;
        font-size: 10px;
    }

    .btn-primary {
        min-height: 40px;
        padding: 0 11px;
        font-size: 10px;
    }

    .product-summary {
        gap: 7px;
    }

    .summary-card {
        min-height: 72px;
        padding: 11px 12px;
    }

    .summary-card strong {
        font-size: 20px;
    }

    .products-toolbar {
        grid-template-columns: minmax(0, 1fr) minmax(105px, .42fr);
        padding: 10px;
    }

    .search-box input {
        font-size: 12px;
    }

    .filter-select {
        font-size: 10px;
    }

    .products-table {
        width: 735px;
        min-width: 735px;
    }

    .products-table .col-code {
        width: 55px;
    }

    .products-table .col-name {
        width: 238px;
    }

    .products-table .col-unit {
        width: 46px;
    }

    .products-table .col-number {
        width: 65px;
    }

    .products-table .col-money {
        width: 80px;
    }

    .products-table .col-margin {
        width: 70px;
    }

    .products-table .col-status {
        width: 125px;
    }

    .products-table th {
        padding-left: 7px;
        padding-right: 7px;
        font-size: 8px;
    }

    .products-table td {
        padding-left: 7px;
        padding-right: 7px;
        font-size: 10px;
    }

    .products-table td.product-name {
        max-width: 238px;
    }
}
