/* --- VARIÁVEIS (TEMA CLEAN & STABLE) --- */
:root {
    --sidebar-bg: #1e1e2d;       /* Dark Blue/Black */
    --sidebar-text: #a2a3b7;
    --active-color: #3699ff;     /* Azul Tech */
    --body-bg: #f3f6f9;          /* Cinza Suave */
    --text-main: #3f4254;
    --card-bg: #ffffff;
    --radius: 12px;              /* Arredondamento Padrão */
    --danger: #f64e60;
    --success: #1bc5bd;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--body-bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex; /* Garante que body é o container pai */
}
#sidebar.active {
    min-width: 80px;
    max-width: 80px;
}

/* Esconde os textos quando fechado */
#sidebar.active ul li a span:not(.icon), 
#sidebar.active .sidebar-header h3,
#sidebar.active .sidebar-footer span:not(.icon) {
    display: none;
}

#sidebar.active .sidebar-header { padding: 20px 5px; }
#sidebar.active ul li a { justify-content: center; padding: 15px; }
#sidebar.active .icon { margin: 0; font-size: 1.5rem; }
/* --- ESTRUTURA --- */
.wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- SIDEBAR (FIXO E ESTÁVEL) --- */
#sidebar {
    min-width: 260px;
    max-width: 260px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    height: 100vh;
}

#sidebar .sidebar-header {
    padding: 25px;
    background: rgba(0,0,0,0.2);
    text-align: center;
}
#sidebar .sidebar-header h3 { color: #fff; margin: 0; font-weight: 700; }

#sidebar ul.components { padding: 20px 0; flex: 1; overflow-y: auto; }

#sidebar ul li a {
    padding: 15px 25px;
    display: flex; align-items: center; gap: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: 0.2s;
    border-left: 3px solid transparent;
}


#sidebar.active {
    min-width: 80px;
    max-width: 80px;
}

/* Esconde os textos quando fechado */
#sidebar.active ul li a span:not(.icon), 
#sidebar.active .sidebar-header h3,
#sidebar.active .sidebar-footer span:not(.icon) {
    display: none;
}

#sidebar.active .sidebar-header { padding: 20px 5px; }
#sidebar.active ul li a { justify-content: center; padding: 15px; }
#sidebar.active .icon { margin: 0; font-size: 1.5rem; }

#sidebar ul li a:hover, #sidebar ul li.active a {
    color: #fff;
    background: #2b2b40;
    border-left-color: var(--active-color);
}

.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.05); }

/* --- CONTEÚDO (MÓVEL) --- */
#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.navbar-top {
    background: #fff;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    display: flex; justify-content: space-between; align-items: center;
}

.container-fluid {
    padding: 30px;
    overflow-y: auto; /* Rolagem só aqui dentro */
    height: 100%;
    padding-bottom: 80px; /* Espaço pro footer não cortar */
}

/* --- CARDS & UI --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: 0 0 20px 0 rgba(76, 87, 125, 0.02);
    margin-bottom: 25px;
    border: 1px solid #eff2f5;
}

.header-page { margin-bottom: 30px; }
.header-page h1 { font-size: 1.5rem; font-weight: 700; color: #181c32; }

/* Grid de Ícones (Cadastros) */
.grid-cadastros {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.card-menu {
    background: #fff; padding: 25px; border-radius: var(--radius);
    text-align: center; cursor: pointer; transition: 0.3s;
    border: 1px solid #eff2f5;
}
.card-menu:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--active-color);
}
.card-menu .icon { font-size: 2rem; display: block; margin-bottom: 10px; }

/* --- MODAL SUAVE (POPUP) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease;
}
.modal-open { display: flex; opacity: 1; }

.modal-box {
    background: #fff;
    padding: 30px;
    border-radius: var(--radius);
    width: 90%; max-width: 500px;
    transform: scale(0.7); /* Começa pequeno */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Efeito elástico */
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}
.modal-open .modal-box { transform: scale(1); } /* Cresce ao tamanho normal */

/* Formulários */
label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; color: #5e6278; }
input, select {
    width: 100%; padding: 12px; border: 1px solid #e1e1e1;
    border-radius: 8px; margin-bottom: 15px; outline: none;
}
input:focus, select:focus { border-color: var(--active-color); background: #f9f9f9; }

.btn-primary {
    background: var(--active-color); color: #fff; border: none;
    padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer;
    width: 100%; transition: 0.2s;
}
.btn-primary:hover { background: #187de4; }
.close-modal { float: right; cursor: pointer; font-size: 1.5rem; margin-top: -10px; }