:root {
    --primary: #9E1B23; /* Vinho/Bordo TecMed */
    --primary-dark: #7a131b;
    --dark: #0f172a;
    --light: #f4f6f9;
    --gray: #64748b;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { display: flex; background-color: var(--light); color: var(--dark); height: 100vh; overflow: hidden; }

/* Sidebar corrigida com flexbox vertical adequado */
.sidebar { width: 260px; background-color: var(--dark); color: #fff; display: flex; flex-direction: column; height: 100vh; flex-shrink: 0; }
.logo-area { padding: 20px; display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2); }
.logo-icon { font-size: 28px; color: var(--primary); }
.logo-text h2 { font-size: 18px; font-weight: bold; }
.logo-text small { font-size: 11px; color: #94a3b8; }

.menu-list { list-style: none; padding: 15px 0; overflow-y: auto; flex: 1; }
.menu-list li a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: #cbd5e1; text-decoration: none; transition: 0.3s; font-size: 14px; }
.menu-list li.active a, .menu-list li a:hover { background-color: var(--primary); color: #fff; }

.sidebar-footer { padding: 15px; background: rgba(0,0,0,0.3); font-size: 12px; text-align: center; border-top: 1px solid rgba(255,255,255,0.05); }
.badge-adm { display: block; color: var(--success); margin-bottom: 8px; font-weight: bold; }
.badge-leitura { display: block; color: var(--warning); margin-bottom: 8px; font-weight: bold; }
.btn-login-toggle { width: 100%; padding: 8px; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-login-toggle.logout { background: var(--danger); text-decoration: none; display: inline-block; text-align: center; }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.top-header { background: #fff; padding: 15px 30px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.top-header h1 { font-size: 20px; color: var(--dark); }
.user-info { font-size: 13px; color: var(--gray); font-weight: 600; }

.content-body { padding: 25px; overflow-y: auto; flex: 1; }

/* Cards & Tabelas */
.card-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-left: 4px solid var(--primary); }
.stat-card h3 { font-size: 24px; color: var(--dark); margin-top: 5px; }
.stat-card span { font-size: 12px; color: var(--gray); font-weight: bold; text-transform: uppercase; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-top: 15px; }
th, td { padding: 12px 15px; text-align: left; font-size: 14px; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; color: var(--dark); font-weight: bold; }
tr:hover { background: #f1f5f9; }

/* Formulários e Botões */
.form-control { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px; margin-top: 5px; }
.btn { padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 14px; }
.btn.primario { background: var(--primary); color: #fff; }
.btn.primario:hover { background: var(--primary-dark); }
.btn.secundario { background: #cbd5e1; color: var(--dark); }

/* Alerta Estoque Baixo */
.estoque-baixo { background-color: #fee2e2 !important; color: #991b1b; font-weight: bold; }

/* Modais Simples */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #fff; padding: 25px; border-radius: 8px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }

/* ================================================= */
/* MENU HAMBURGUER RESPONSIVO (MOBILE E TABLETS)     */
/* ================================================= */

/* Botão do menu hamburguer (fica oculto em computadores) */
.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--dark);
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 992px) {
    body {
        flex-direction: column;
        height: 100vh;
        overflow: auto;
    }

    /* Exibe o botão de hambúrguer no topo */
    .menu-toggle-btn {
        display: inline-block;
    }

    /* Oculta a sidebar por padrão em telas pequenas */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 1100;
        transition: left 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0,0,0,0.3);
    }

    /* Classe ativada via JavaScript para abrir o menu */
    .sidebar.ativo {
        left: 0;
    }

    .main-content {
        width: 100%;
        height: 100vh;
        overflow-y: auto;
    }

    .top-header {
        padding: 12px 20px;
    }

    /* Ajuste de tabelas e modais para mobile */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        padding: 15px;
    }

    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}