/* Controle de Amostras - Estilos Específicos */

.controle-amostras-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    height: 100%;
    position: relative;
}

/* Layout com drawer aberto em desktop */
@media (min-width: 1200px) {
    .controle-amostras-layout.drawer-open {
        grid-template-columns: 1fr 500px;
    }
}

/* Coluna Esquerda - Lista de Amostras */
.amostras-lista {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    height: 100%;
}

/* Botão para abrir drawer */
.btn-abrir-drawer {
    display: none;
    width: 100%;
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.btn-abrir-drawer:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-abrir-drawer i {
    margin-right: 0.5rem;
}

/* Mostrar botão em telas menores */
@media (max-width: 1199px) {
    .btn-abrir-drawer {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.amostras-secao {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-height: 0; /* Importante para permitir scroll */
}

.secao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.secao-header h3 {
    margin: 0;
    color: #455A64;
    font-size: 1.2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Grid de Amostras com Scroll */
.amostras-grid-scroll {
    display: grid;
    gap: 0.50rem;
    overflow-y: auto;
    max-height: 600px; /* Altura fixa */
    padding-right: 0.5rem;
}

/* Scrollbar customizada */
.amostras-grid-scroll::-webkit-scrollbar {
    width: 7px;
}

.amostras-grid-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.amostras-grid-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.amostras-grid-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.amostra-card {    
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.amostra-card:hover {
    background: #e8f4f8;
    border-color: #3498db;
    transform: translateX(4px);
}

.amostra-card.selecionada {
    background: #e3f2fd;
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.amostra-card.inativa {
    opacity: 0.7;
}

.amostra-card.inativa:hover {
    background: #ffebee;
    border-color: #ef5350;
}

.amostra-checkbox {
    display: flex;
    align-items: center;
}

.amostra-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.amostra-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.amostra-titulo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.amostra-titulo h4 {
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 600;
}

.amostra-detalhes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
}

.amostra-detalhes span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.amostra-detalhes i {
    color: #3498db;
}

/* Totalizadores */
.totalizadores {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.totalizador {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.totalizador .label {
    font-size: 0.85rem;
    color: #666;
}

.totalizador .valor {
    font-size: 1.5rem;
    font-weight: bold;
    color: #455A64;
}

/* Coluna Direita - Detalhes da Amostra (Drawer) */
.amostra-detalhes-drawer {
    position: fixed;
    top: 0;
    right: -600px; /* Escondido por padrão */
    width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.amostra-detalhes-drawer.aberto {
    right: 0;
}

/* Em desktop com drawer aberto, posiciona o drawer dentro do layout */
@media (min-width: 1200px) {
    .amostra-detalhes-drawer {
        position: static;
        right: auto;
        width: 100%;
        height: 100%;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        border-radius: 8px;
        transition: none;
        z-index: auto;
    }

    .amostra-detalhes-drawer.aberto {
        right: auto;
    }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #455A64;
    color: white;
    flex-shrink: 0;
}

.drawer-header h3 {
    margin: 0;
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.btn-fechar-drawer {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 1rem;
}

.btn-fechar-drawer:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* Esconder botão de fechar em desktop */
@media (min-width: 1200px) {
    .btn-fechar-drawer {
        display: none;
    }
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Overlay para mobile */
.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 1199px) {
    .drawer-overlay {
        display: block;
    }
}

/* Lista de Empresas */
.drawer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Antiga classe panel-header removida */
.panel-header {
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
    color: #455A64;
    font-size: 1.2rem;
}

/* Coluna Direita antiga - substituída pelo drawer */
.amostra-detalhes-panel {
    display: none; /* Não é mais usada */
}

.empresa-card {
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.empresa-card:hover {
    background: #e8f4f8;
    border-color: #3498db;
}

.empresa-card.selecionada {
    background: #e3f2fd;
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.empresa-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.empresa-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 600;
}

.empresa-opcoes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0;
}

.checkbox-inline input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.empresa-quantidade {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empresa-quantidade label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #455A64;
    margin: 0;
}

.empresa-quantidade input {
    max-width: 200px;
}

/* Última Alteração */
.ultima-alteracao {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.ultima-alteracao h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: #856404;
}

.ultima-alteracao p {
    margin: 0;
    font-size: 0.85rem;
    color: #856404;
    white-space: pre-line;
}

/* Modal de Filtros */
.modal-lg {
    max-width: 800px;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.filtros-checkbox {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Rodapé com Botões */
.page-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

/* Dropdown de Impressão */
.btn-group {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    position: relative;
    padding-right: 2.5rem;
}

.dropdown-toggle::after {
    content: "\f0d7";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 250px;
    padding: 0.5rem 0;
    margin: 0 0 0.125rem;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.175);
}

.dropdown-menu.dropup {
    bottom: 100%;
    top: auto;
    margin: 0 0 0.125rem;
}

.dropdown-menu.dropdown {
    top: 100%;
    bottom: auto;
    margin: 0.125rem 0 0;
}

.btn-group:focus-within .dropdown-menu,
.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #16181b;
}

.dropdown-item i {
    color: #dc3545;
    font-size: 0.9rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: #3498db;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-danger {
    background: #e74c3c;
    color: white;
}

.badge-warning {
    background: #f39c12;
    color: white;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #999;
    text-align: center;
}

.empty-state i {
    margin-bottom: 1rem;
    color: #ccc;
}

.empty-state p {
    margin: 0;
    font-size: 1.1rem;
}

/* Responsividade */
@media (max-width: 1200px) {
    .controle-amostras-layout {
        grid-template-columns: 1fr;
    }

    .amostra-detalhes-drawer {
        width: 90%;
        max-width: 500px;
    }
}

@media (max-width: 992px) {
    .controle-amostras-layout {
        grid-template-columns: 1fr;
    }

    .filtros-grid {
        grid-template-columns: 1fr;
    }

    .amostra-detalhes-drawer {
        width: 100%;
        max-width: 100%;
    }

    .amostras-grid-scroll {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .amostra-detalhes span {
        font-size: 0.8rem;
    }

    .totalizadores {
        flex-direction: column;
        gap: 1rem;
    }

    .empresa-opcoes {
        grid-template-columns: 1fr;
    }

    .page-footer {
        flex-direction: column;
    }

    .page-footer .btn {
        width: 100%;
    }

    .amostras-grid-scroll {
        max-height: 400px;
        gap: 0.5rem; /* Reduzir espaçamento entre cards */
    }

    .drawer-header h3 {
        font-size: 0.95rem;
    }

    /* Ajustes nos cards de amostra para mobile */
    .amostra-card {
        padding: 0.5rem; /* Reduzir padding */
        gap: 0.5rem;
        border-width: 1px;
    }

    .amostra-checkbox input[type="checkbox"] {
        width: 16px; /* Reduzir tamanho do checkbox */
        height: 16px;
    }

    .amostra-titulo {
        gap: 0.35rem;
    }

    .amostra-titulo h4 {
        font-size: 0.85rem; /* Reduzir tamanho da fonte do título */
    }

    .amostra-titulo .badge {
        padding: 0.15rem 0.5rem; /* Reduzir padding do badge */
        font-size: 0.65rem; /* Reduzir fonte do badge */
    }

    .amostra-info {
        gap: 0.35rem; /* Reduzir espaçamento interno */
    }

    .amostra-detalhes {
        gap: 0.5rem; /* Reduzir espaçamento entre itens */
        font-size: 0.75rem; /* Reduzir fonte dos detalhes */
    }

    .amostra-detalhes i {
        font-size: 0.7rem; /* Reduzir ícones */
    }

    /* Ajustes na seção de amostras */
    .amostras-secao {
        padding: 0.75rem;
    }

    .secao-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.35rem;
    }

    .secao-header h3 {
        font-size: 1rem;
    }

    .checkbox-label {
        font-size: 0.8rem;
        gap: 0.35rem;
    }

    .checkbox-label input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    /* Ajustes nos cards de empresa no drawer */
    .empresa-card {
        padding: 0.75rem;
    }

    .empresa-header h4 {
        font-size: 0.9rem;
    }

    .empresa-opcoes {
        gap: 0.5rem;
    }

    .checkbox-inline {
        font-size: 0.8rem;
        gap: 0.35rem;
    }

    .checkbox-inline input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .empresa-quantidade label {
        font-size: 0.8rem;
    }

    .empresa-acoes .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ddd;
}

    .modal-header h3 {
        margin: 0;
    }

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }

.form-check {
    margin-top: 1rem;
}
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

    .loading-spinner h3 {
        color: #2c3e50;
        margin-bottom: 0.5rem;
    }

    .loading-spinner p {
        color: #7f8c8d;
    }

.loading-gif {
    width: 200px;
    height: 200px;
    margin-bottom: 1.5rem;
}

/* Estilo para bot\u00e3o de a\u00e7\u00e3o nas empresas */
.empresa-acoes {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
}

.empresa-acoes .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Estilo para conte\u00fado do modal de altera\u00e7\u00e3o */
.alteracao-detalhes {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.alteracao-detalhes pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}
