:root {
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #252525;
    --neon: #ACFF00;
    --neon-hover: #bfff4d;
    --text-main: #f0f0f0;
    --text-muted: #888;
    --danger: #ff0055;
    --success: #00e676;
    --info: #2979ff;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }

/* LOGIN PAGE */
body.login-page {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    border-top: 4px solid var(--neon);
    box-shadow: 0 0 20px rgba(172, 255, 0, 0.1);
}

.login-box h2 { text-align: center; color: var(--neon); margin-bottom: 30px; letter-spacing: 2px; }

/* LAYOUT PRINCIPAL */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 50; /* Garante que fique acima do conteúdo */
}

.brand {
    padding: 30px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--neon);
    border-bottom: 1px solid #333;
    letter-spacing: 1px;
}

.nav-links {
    padding: 20px 0;
    flex: 1;
}

.nav-links a {
    display: block;
    padding: 15px 30px;
    color: var(--text-muted);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-links a:hover, .nav-links a.active {
    background: #222;
    color: white;
    border-left-color: var(--neon);
}

.nav-links a.logout { color: var(--danger); margin-top: auto; }
.nav-links a.logout:hover { background: rgba(255, 0, 85, 0.1); border-left-color: var(--danger); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
}

/* COMPONENTES */
h1 { font-size: 28px; margin-bottom: 10px; }
.subtitle { color: var(--text-muted); margin-bottom: 30px; display: block; }

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 8px;
    border-bottom: 2px solid var(--neon);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.stat-card h3 { font-size: 36px; color: white; margin: 10px 0; }
.stat-card span { color: var(--text-muted); font-size: 14px; text-transform: uppercase; }

/* FORMS E TABLES */
.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.form-row { 
    display: flex; 
    gap: 15px; 
    align-items: flex-end; 
    flex-wrap: wrap; /* Permite quebrar em linhas no mobile */
}

/* Ajusta largura total para itens de formulário no mobile */
.form-row > div {
    flex-grow: 1;
    min-width: 150px;
}

input, select {
    background: var(--bg-input);
    border: 1px solid #333;
    color: white;
    padding: 12px 15px;
    border-radius: 5px;
    width: 100%;
}
input:focus { border-color: var(--neon); }

button.btn-primary {
    background: var(--neon);
    color: black;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    white-space: nowrap;
}
button.btn-primary:hover { background: var(--neon-hover); }

/* Tabelas responsivas */
.table-responsive {
    overflow-x: auto;
}

table { 
    width: 100%; 
    min-width: 600px; /* Garante que a tabela não fique espremida */
    border-collapse: collapse; 
    margin-top: 15px; 
}
th { text-align: left; padding: 15px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; border-bottom: 1px solid #333; }
td { padding: 15px; border-bottom: 1px solid #333; color: #ddd; }
tr:hover td { background: #222; }

.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.b-success { background: rgba(0, 230, 118, 0.1); color: var(--success); border: 1px solid var(--success); }
.b-danger { background: rgba(255, 0, 85, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.b-info { background: rgba(41, 121, 255, 0.1); color: var(--info); border: 1px solid var(--info); }
.b-warn { background: rgba(255, 152, 0, 0.1); color: #ff9800; border: 1px solid #ff9800; }

.action-btn { font-size: 11px; padding: 5px 10px; border-radius: 3px; border: none; cursor: pointer; color: white; margin-right: 5px; }
.btn-reset { background: var(--info); }
.btn-block { background: var(--danger); }
.btn-active { background: var(--success); }
.btn-edit { background: #ff9800; color: black; }
.btn-del { background: #ff0055; color: white; }

/* MODAL */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}
.modal.show { display: flex; }
.modal-content {
    background-color: var(--bg-card);
    padding: 30px;
    border: 1px solid var(--neon);
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 0 20px rgba(172, 255, 0, 0.2);
}
.close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal:hover { color: white; }

/* MENU MOBILE (Hamburger) */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: var(--neon);
    color: black;
    border-radius: 5px;
    cursor: pointer;
    z-index: 100;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
}

/* --- RESPONSIVIDADE (Telas Pequenas, Mobile) --- */
@media (max-width: 768px) {
    body {
        padding: 0;
        /* Remove o flex para que o menu toggle funcione */
        display: block; 
    }
    
    .sidebar {
        /* Esconde por padrão */
        left: calc(var(--sidebar-width) * -1); 
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    }
    
    .sidebar.open {
        left: 0; /* Abre quando a classe 'open' é aplicada */
    }
    
    .main-content {
        /* Ocupa 100% da largura, sem margem lateral */
        margin-left: 0; 
        padding: 20px;
        padding-top: 70px; /* Espaço para o menu toggle */
    }
    
    .menu-toggle {
        display: flex;
    }
    
    h1 {
        font-size: 24px;
    }
    
    /* Ajustes específicos para mobile */
    .stats-grid {
        grid-template-columns: 1fr; /* 1 coluna */
        gap: 15px;
    }

    .form-row button.btn-primary {
        width: 100%; /* Botões ocupam largura total */
        margin-top: 10px; 
    }

    /* Tabelas devem ter scroll lateral */
    .table-responsive {
        /* Já está definido como overflow-x: auto, garante que funcione */
        width: 100%;
    }
}