/* Resets básicos e Variáveis */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* Telas principais */
.view { display: none; }
.view.active { display: block; }

.page { display: none; }
.page.active { display: block; }

/* Botoes e Inputs genéricos */
button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background-color: var(--primary-hover);
}

input, select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

/* TELA DE LOGIN */
#login-view {
    height: 100vh;
    display: none; /* Controlado via JS */
    place-items: center;
}
#login-view.active { display: grid; }

.login-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-container h2 { margin-bottom: 1.5rem; }
.login-container button { width: 100%; }

/* ÁREA LOGADA - Layout Padrão Dashboard */
#app-view {
    display: flex;
    min-height: 100vh;
}

nav {
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

nav h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    text-align: center;
}

nav ul { list-style: none; }
nav ul li { margin-bottom: 0.5rem; }
nav ul li button {
    width: 100%;
    background: transparent;
    color: var(--text-main);
    text-align: left;
    border-radius: 0.25rem;
}
nav ul li button:hover { background: var(--bg-color); color: var(--primary); }

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Responsivo para celular */
@media (max-width: 768px) {
    #app-view { flex-direction: column; }
    nav { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    nav ul { display: flex; overflow-x: auto; padding-bottom: 0.5rem; gap: 0.5rem;}
    nav ul li { margin-bottom: 0; flex-shrink: 0; }
}

/* =========================================
   ESTILOS DE IMPRESSÃO (RELATÓRIOS)
   ========================================= */
@media print {
    /* 1. Esconde a navegação e todos os botões */
/* 1. Esconde a navegação, os botões e a barra de filtro */
    nav, button, #filtro-container {
        display: none !important;
    }

    /* 2. Ajusta o layout para ocupar a folha toda */
    #app-view {
        display: block; 
    }
    .content {
        padding: 0;
        overflow: visible;
    }

    /* 3. Tira cores de fundo e bordas desnecessárias para economizar tinta */
    body {
        background-color: white;
        color: black;
    }
    .tabela-container {
        border: none !important;
        padding: 0 !important;
    }

    /* 4. Coloca bordas sólidas na tabela para leitura no papel */
    table {
        border: 1px solid black;
    }
    th, td {
        border-bottom: 1px solid #ccc !important;
    }

    /* 5. Adiciona um título que só aparece na impressão (opcional) */
    #historico::before {
        content: "Relatório de Vendas - EstoqueApp";
        display: block;
        font-size: 1.5rem;
        font-weight: bold;
        text-align: center;
        margin-bottom: 2rem;
        border-bottom: 2px solid black;
        padding-bottom: 0.5rem;
    }
}