/* Listagem de Amostras - somente leitura.
   Estética deliberadamente distinta da tela de edição: tabela densa no desktop,
   cards compactos no mobile, flags como badges em vez de checkboxes. */

.listagem-amostras {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    overflow: hidden;
}

/* Em tela estreita o cabeçalho divide espaço com o título: fica só o ícone */
@media (max-width: 480px) {
    .btn-editar-amostras span {
        display: none;
    }
}

/* Barra de busca + ações */
.listagem-barra {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.listagem-barra input {
    flex: 1;
    min-width: 0;
}

/* Resumo dos filtros ativos */
.filtros-ativos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex-shrink: 0;
}

.filtro-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    background: #ECEFF1;
    color: #455A64;
    border-radius: 999px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.filtro-chip strong {
    font-weight: 600;
}

/* ─── Tabela (desktop) ─── */
.listagem-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tabela-amostras {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tabela-amostras th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #455A64;
    color: white;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.tabela-amostras td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ECEFF1;
    vertical-align: middle;
}

.tabela-amostras tbody tr:hover td {
    background: #F5FAFD;
}

.tabela-amostras .col-numero {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tabela-amostras .col-id {
    color: #90A4AE;
    font-size: 0.8rem;
    white-space: nowrap;
}

.tabela-amostras .produto-nome {
    font-weight: 600;
    color: #37474F;
}

.linha-inativa .produto-nome {
    color: #90A4AE;
    text-decoration: line-through;
}

/* ─── Badges de flag ─── */
.flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.flag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.flag-empresa {
    background: #ECEFF1;
    color: #546E7A;
}

.flag-falta {
    background: #FFEBEE;
    color: #C62828;
}

.flag-showroom {
    background: #E3F2FD;
    color: #1565C0;
}

.flag-livro {
    background: #F3E5F5;
    color: #6A1B9A;
}

.flag-status {
    background: #FFF3E0;
    color: #E65100;
}

/* A loja tem a peça de fato. Mantida pela entrada e pela transferência, não é marcação manual. */
.flag-amostra {
    background: #E8F5E9;
    color: #2E7D32;
}

/* ─── Cards (mobile) ─── */
.cards-amostras {
    display: none;
}

.card-amostra {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
}

.card-amostra-topo {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.card-amostra-topo .produto-nome {
    font-weight: 600;
    color: #37474F;
    font-size: 0.9rem;
}

.card-amostra-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #78909C;
    margin-bottom: 0.4rem;
}

.card-amostra.inativa .produto-nome {
    color: #90A4AE;
    text-decoration: line-through;
}

/* Empresa dentro do card */
.card-empresa {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0;
    border-top: 1px dashed #ECEFF1;
}

.card-empresa-nome {
    font-size: 0.75rem;
    font-weight: 600;
    color: #546E7A;
    min-width: 5rem;
}

@media (max-width: 992px) {
    /* No mobile quem rola é o .page-content: sem soltar a altura aqui, o
       overflow:hidden do container cortaria os últimos cards. */
    .listagem-amostras {
        height: auto;
        overflow: visible;
    }

    .listagem-scroll {
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .tabela-amostras {
        display: none;
    }

    .cards-amostras {
        display: block;
    }
}

/* A paginação é irmã do scroll dentro do flex; não pode ser espremida por ele */
.listagem-amostras .paginacao-container {
    flex-shrink: 0;
    margin: 0 auto;
}

/* Estado vazio */
.listagem-vazia {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #90A4AE;
    text-align: center;
}

.listagem-vazia i {
    margin-bottom: 1rem;
    color: #CFD8DC;
}
