@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #212529;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    background-color: #34495e;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* Cria um espaço entre o ícone e o texto */
}

.sidebar nav ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
    background-color: #0d6efd;
    color: #fff;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    flex-grow: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.main-content header h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    body {
        flex-direction: column;
    }
}

/* Generic Components */
.card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.btn {
    display: inline-block;
    font-weight: 500;
    color: #fff;
    text-align: center;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn-success {
    background-color: #198754;
}

.btn-danger {
    background-color: #dc3545;
}
/* Legacy styles from previous implementation might need to be adapted or replaced */
/* For example, table styles can be generalized */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f1f2f6;
}

.table .actions {
    display: flex;
    gap: 10px;
}

.table .btn-edit, .table .btn-delete {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.btn-edit {
    background-color: #f0ad4e;
}

.btn-delete {
    background-color: #d9534f;
}

/* Movement Page Specific Styles */
.movement-forms-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.movement-form-wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dfe6e9;
}

.movement-form-wrapper h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 10px;
}

#entry-wrapper {
    border-left: 5px solid #27ae60; /* Green for entry */
}

#exit-wrapper {
    border-left: 5px solid #c0392b; /* Red for exit */
}

.auto-filled-field {
    font-size: 0.9rem;
    color: #555;
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    border-radius: 0.25rem;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    animation-name: animatetop;
    animation-duration: 0.4s
}

/* Add Animation */
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.modal-header {
    padding: 1rem 1.25rem;
    background-color: #34495e;
    color: white;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
}

.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

/* Config Buttons */
.config-buttons-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Estilos para filtros e ordenação da tabela */
#filters-row .form-control {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

#headers-row th {
    cursor: pointer;
    position: relative;
}

#headers-row th:hover {
    background-color: #e9ecef;
}

#headers-row th::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    margin-top: -8px;
    border: 4px solid transparent;
}

#headers-row th.sort-asc::after {
    border-bottom-color: #212529;
}

#headers-row th.sort-desc::after {
    border-top-color: #212529;
}

/* Estilo para container de filtros genérico */
.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* Layout do Formulário de Movimentação */
.form-grid-4-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Estilos para o Interruptor (Toggle Switch) */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #dc3545; /* Cor de Saída (vermelho) */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #198754; /* Cor de Entrada (verde) */
}

input:checked + .slider:before {
    transform: translateX(26px);
}

#info-modal-header {
    background-color: #0d6efd; /* Azul informativo do Bootstrap */
}

/* Estilos para Célula de Tipo na Tabela de Movimentações (VERSÃO CORRIGIDA) */

#table-movimentacoes td.entrada,
#table-movimentacoes td.saida {
    color: white;
    text-align: center;
    font-weight: 600;
    border-radius: 4px;
    border-bottom: 2px solid #fff;
}

#table-movimentacoes td.entrada {
    background-color: #198754; /* Verde (btn-success) */
}

#table-movimentacoes td.saida {
    background-color: #dc3545; /* Vermelho (btn-danger) */
}

/* Mantém a cor da célula mesmo com o efeito hover da linha da tabela.
  Esta regra é mais específica e por isso prevalece sobre a regra de hover genérica.
*/
#table-movimentacoes tr:hover td.entrada {
    background-color: #198754;
}

#table-movimentacoes tr:hover td.saida {
    background-color: #dc3545;
}

/* --- Estilos CORRIGIDOS para o Componente Dropdown --- */
.dropdown {
    position: relative;
    display: inline-block;
}

/* O conteúdo do dropdown fica oculto por padrão */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f9f9f9;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10;
    border-radius: 4px;
    overflow: hidden; /* Garante que os cantos arredondados sejam aplicados nos links */
}

/* Mostra o conteúdo quando o dropdown tem a classe .active */
.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: #0d6efd;
    color: white;
}

.dropdown .btn {
  color: white;
}

/* --- Estilos para o Componente Multi-Select --- */
.multiselect-container {
    position: relative;
}

.multiselect-display-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    height: calc(1.5em + 1rem + 2px); /* Altura igual ao .form-control */
    user-select: none;
}

.multiselect-display-area .multiselect-placeholder,
.multiselect-display-area .multiselect-selected-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multiselect-arrow {
    border: solid #555;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    margin-left: 10px;
}

.multiselect-options {
    display: none;
    position: absolute;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}

.multiselect-options ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.multiselect-options li {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.multiselect-options li:hover {
    background-color: #f1f2f6;
}

.multiselect-options input[type="checkbox"] {
    margin-right: 10px;
}

/* Ajusta a largura do campo de descrição no formulário de produtos */
#form-produto #produto-descricao {
    grid-column: span 2; /* Faz o campo ocupar duas colunas do grid */
}

/* Estilos para o Interruptor (Toggle Switch) */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #6c757d; /* Cor padrão */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #0d6efd; /* Cor do Produto (azul) */
}

input:checked + .slider:before {
    transform: translateX(26px);
}
