/* Reset Básico e Fontes */
body, html {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f0f2f5;
    color: #333;
}

/* Layout Principal */
.container { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background-color: #ffffff; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; }
.main-content { flex-grow: 1; display: flex; flex-direction: column; }
.content-area { padding: 2rem; }

/* Barra Lateral */
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #e0e0e0; }
.sidebar-header h1 { margin: 0; font-size: 1.5rem; text-align: center; color: #1a202c; }
.sidebar-nav { display: flex; flex-direction: column; padding: 1rem; }
.sidebar-nav a { padding: 0.75rem 1rem; text-decoration: none; color: #4a5568; border-radius: 6px; margin-bottom: 0.5rem; }
.sidebar-nav a:hover, .sidebar-nav a.active { background-color: #2d3748; color: #ffffff; }
.sidebar-nav .nav-category { font-size: 0.75rem; color: #a0aec0; text-transform: uppercase; padding: 1rem 1rem 0.5rem; font-weight: bold; }

/* Cabeçalho Principal */
.main-header { height: 70px; background-color: #ffffff; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: flex-end; padding: 0 2rem; }
.user-info { display: flex; align-items: center; }
.user-info span { font-weight: bold; margin-right: 1rem; }
.logout-button { background: #e53e3e; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 6px; }
.logout-button:hover { background: #c53030; }

/* Formulário de Login */
.login-wrapper { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-box { padding: 2rem; background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.login-box h2 { text-align: center; margin-bottom: 1.5rem; }
.login-box .input-group { margin-bottom: 1rem; }
.login-box label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.login-box input { width: 100%; padding: 0.75rem; border: 1px solid #cbd5e0; border-radius: 6px; box-sizing: border-box; }
.login-box button { width: 100%; padding: 0.75rem; border: none; background-color: #2d3748; color: white; border-radius: 6px; font-size: 1rem; cursor: pointer; }
.login-box .error { background-color: #fed7d7; color: #c53030; padding: 0.75rem; border-radius: 6px; text-align: center; margin-bottom: 1rem; }

/* Estilos para Tabelas */
.content-table { background-color: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background-color: #f7fafc; font-size: 0.8rem; text-transform: uppercase; color: #718096; }
td .main-info { font-weight: 500; }
td .sub-info { font-size: 0.85rem; color: #718096; }
tbody tr:hover { background-color: #f7fafc; }

/* Página com Cabeçalho e Botão */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-header h1 { margin: 0; }
.btn { padding: 0.6rem 1.2rem; text-decoration: none; border-radius: 6px; font-weight: bold; border: none; cursor: pointer; }
.btn-primary { background-color: #2d3748; color: white; }
.btn-primary:hover { background-color: #1a202c; }
.btn-secondary { background-color: #e2e8f0; color: #2d3748; }
.btn-secondary:hover { background-color: #cbd5e0; }

/* Status Badge */
.status-badge { padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: bold; }
.status-ativo { background-color: #c6f6d5; color: #2f855a; }
.status-inativo { background-color: #fed7d7; color: #c53030; }
.status-bloqueado { background-color: #f7fafc; color: #718096; border: 1px solid #e2e8f0; }

/* Ações na Tabela */
.action-btn { font-size: 0.85rem; color: #4299e1; text-decoration: none; margin-right: 1rem; }
.action-btn.btn-danger { color: #e53e3e; }

/* Estilos para Formulários */
.form-grid { display: grid; gap: 2rem; }
fieldset { border: 1px solid #e2e8f0; border-radius: 8px; }
legend { font-weight: bold; font-size: 1.1rem; padding: 0 0.5rem; }
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.input-group input, .input-group textarea, .input-group select { width: 100%; padding: 0.75rem; border: 1px solid #cbd5e0; border-radius: 6px; box-sizing: border-box; }
.form-actions { margin-top: 1rem; }

/* Novos Status para Equipamentos */
.status-disponível { background-color: #c6f6d5; color: #2f855a; }
.status-alugado { background-color: #bee3f8; color: #2b6cb0; }
.status-em-manutenção { background-color: #feebc8; color: #9c4221; }
.status-inativo { background-color: #e2e8f0; color: #4a5568; }

/* --- ESTILOS GLOBAIS PARA MODAIS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* Inicia oculto */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Garante que fique sobre todo o conteúdo */
    padding: 2rem;
    box-sizing: border-box;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px; /* Largura padrão, pode ser sobrescrita */
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-body {
    max-height: 70vh; /* Limita a altura para telas menores */
    overflow-y: auto; /* Adiciona scroll se o conteúdo for grande */
    flex-grow: 1;
}

/* --- Cores de Fundo para Linhas de Tabela (Status) --- */
tr.status-row-paga { background-color: #f0fff4; }
tr.status-row-pendente { background-color: #fffaf0; }
tr.status-row-atrasada { background-color: #fff5f5; }

tr.status-row-paga:hover { background-color: #c6f6d5 !important; }
tr.status-row-pendente:hover { background-color: #feebc8 !important; }
tr.status-row-atrasada:hover { background-color: #fed7d7 !important; }

/* --- Estilos para o Botão do Menu (Hamburguer) --- */
.sidebar-toggle {
    display: none; /* Escondido em telas grandes */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002; /* Fica acima de quase tudo */
}

.sidebar-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: 0.3s;
}

/* --- Classe para quando o menu estiver aberto --- */
.sidebar-toggled {
    transform: translateX(0) !important; /* Força o menu a aparecer */
}

/* --- Overlay para escurecer o fundo --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ==========================================================================
   CSS UNIVERSAL PARA RESPONSIVIDADE - Adicionar ao final de style.css
   ========================================================================== */

/* Define o ponto de quebra para tablets e celulares (768px é um valor comum) */
@media screen and (max-width: 768px) {


    /* --- 1. Layout Responsivo com Menu Retrátil --- */
.sidebar {
    position: fixed; /* Fica fixo na tela ao rolar */
    left: 0;
    top: 0;
    height: 100%;
    z-index: 1001; /* Fica acima do overlay e do conteúdo */
    transform: translateX(-100%); /* Começa escondido à esquerda */
    transition: transform 0.3s ease-in-out; /* Animação de deslize */
    width: 280px; /* Largura do menu quando aberto */
    box-shadow: 4px 0px 15px rgba(0,0,0,0.1);
    
    /* Adições para controle de rolagem interna */
    display: flex;
    flex-direction: column;
}

/* Faz a área principal de navegação ser rolável */
.sidebar-nav {
    overflow-y: auto; /* Adiciona a rolagem vertical quando necessário */
    flex-grow: 1; /* Faz esta área ocupar o espaço disponível */
}

.main-header {
    justify-content: space-between; /* Espaça o botão e o user-info */
}

.sidebar-toggle {
    display: block; /* Mostra o botão em telas pequenas */
}

/* Ajusta o conteúdo principal para não ter a sidebar ao lado */
.main-content {
    width: 100%;
}

    /* Reduz o padding em telas pequenas para ganhar espaço */
    .content-area {
        padding: 1rem;
    }
    
    /* --- 2. Cabeçalhos de Página --- */
    /* Empilha o título e os botões de ação */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* --- 3. Grades de Formulários e Filtros --- */
    /* Transforma todas as grades de múltiplas colunas em uma única coluna */
    .form-grid,
    .form-grid-columns,
    .readonly-grid,
    .report-card-grid,
    .report-chart-grid,
    .inventory-container,
    .page-actions-bar .filters {
        grid-template-columns: 1fr; /* Força uma única coluna */
    }

    /* Ajusta a barra de filtros para empilhar verticalmente */
    .page-actions-bar {
        padding: 1rem;
    }

    .page-actions-bar .filters {
        flex-direction: column;
        align-items: stretch; /* Faz os inputs ocuparem a largura total */
    }
    
    .page-actions-bar .filters .input-group {
        width: 100%;
    }

    /* --- 4. Tabelas --- */
    /* A solução mais eficaz sem alterar o HTML é permitir a rolagem horizontal da tabela */
    .content-table {
        overflow-x: auto; /* CRUCIAL: Adiciona a barra de rolagem horizontal */
        -webkit-overflow-scrolling: touch; /* Melhora a experiência de rolagem em iOS */
    }

    table {
        min-width: 600px; /* Força uma largura mínima para a tabela, fazendo a rolagem aparecer */
    }

    /* --- 5. Modais --- */
    /* Garante que os modais não ocupem a tela inteira */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    /* --- 6. Ajustes Gerais --- */
    /* Diminui um pouco os títulos para melhor encaixe */
    h1 {
        font-size: 1.5rem;
    }

    .report-card .card-value {
        font-size: 1.75rem;
    }
}