@import url('variables_app.css');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; 
}

/* --- CONFIGURAÇÃO GLOBAL DO BODY --- */
body {
    background-color: var(--bege-claro);
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark);
}

/* TRUQUE DE CSS: 
   Aplica centralização (Flex Center) APENAS se NÃO for a tela do Dashboard.
   Isso conserta o bug da tela "espremida" no meio.
*/
body:not(.dashboard-body) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* --- ESTILOS DE FORMULÁRIOS E TELAS MENORES --- */
.container {
    background-color: var(--branco-neutro);
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--rosa-suave);
    overflow: hidden; 
    position: relative;
    margin: auto; /* Garante centralização se necessário */
}

/* Botão Voltar */
.btn-voltar {
    display: inline-block;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: color 0.3s;
    font-weight: 600;
}

.btn-voltar:hover {
    color: var(--primary-pink);
}

.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header h2 {
    color: var(--titulo-escuro); /* Cor ajustada (Antigo Marrom) */
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1rem;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--titulo-escuro); /* Cor ajustada */
    font-weight: 600;
    font-size: 0.9rem;
}

input[type="text"], input[type="password"], input[type="number"], input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--rosa-suave);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-dark);
    background-color: var(--white);
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box; 
}

input:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 4px var(--shadow);
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-pink);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s;
    margin-bottom: 2rem;
}

.btn-submit:hover {
    background-color: var(--rosa-escuro);
    transform: translateY(-2px);
}

/* --- Estilos da Lista (Tabela) --- */
.lista-categorias {
    border-top: 2px dashed var(--rosa-suave);
    padding-top: 1.5rem;
}

.lista-categorias h3 {
    color: var(--titulo-escuro);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--rosa-suave);
    color: var(--text-dark);
    font-size: 0.9rem;
}

th {
    color: var(--titulo-escuro);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

/* Botões de Ação na Tabela */
.acoes {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-acao {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-editar {
    background-color: var(--pastel-pink);
    color: var(--titulo-escuro);
}

.btn-editar:hover {
    background-color: var(--primary-pink);
    color: white;
}

.btn-excluir {
    background-color: #ffebee;
    color: #c62828;
}

.btn-excluir:hover {
    background-color: #ffcdd2;
}

/* Mensagens */
.mensagem {
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    width: 100%;
}

.sucesso { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.erro { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }


/* =========================================
   ESTILOS DO DASHBOARD (INDEX / PAINEL)
   ========================================= */

.dashboard-body {
    display: flex; /* Garante layout lado a lado */
    flex-direction: row;
    height: 100vh; /* Altura total da tela */
    width: 100vw;  /* Largura total */
    overflow: hidden; /* Evita scroll na tela principal */
    background-color: var(--bege-claro);
    justify-content: flex-start; /* FIX: Alinha itens no começo (Esquerda) */
    align-items: stretch; /* FIX: Estica altura total */
}

/* Menu Lateral (Sidebar) */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg); /* Nova cor rosa */
    color: var(--titulo-escuro); /* Texto escuro para contraste */
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    flex-shrink: 0;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.logo-area {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff; /* Logo em branco para destaque no rosa */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.menu-items {
    flex: 1;
    overflow-y: auto;
    padding-top: 20px;
}

/* Botões do Menu */
.menu-btn {
    width: 100%;
    background: none;
    border: none;
    color: #fff; /* Texto branco no menu rosa */
    padding: 15px 20px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.menu-btn:hover {
    background-color: rgba(255,255,255,0.2);
    color: var(--white);
}

.menu-btn.active {
    background-color: var(--bege-claro); /* Fundo claro quando ativo */
    border-left-color: var(--titulo-escuro);
    color: var(--titulo-escuro); /* Texto escuro quando ativo */
}

/* Submenus (Cascata) */
.submenu {
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0,0,0,0.05); /* Levemente mais escuro que o rosa */
    transition: max-height 0.3s ease-out;
}

.submenu.open {
    max-height: 500px;
}

.submenu a {
    display: block;
    padding: 12px 20px 12px 40px;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    cursor: pointer;
}

.submenu a:hover {
    color: var(--titulo-escuro);
    background-color: rgba(255,255,255,0.3);
    font-weight: 600;
}

/* Área Principal */
.main-content {
    flex: 1; /* Ocupa todo o espaço restante */
    display: flex;
    flex-direction: column;
    background-color: #f4f4f4;
    height: 100%; /* Garante altura total */
    min-width: 0; /* Evita quebra de layout flex */
}

/* Topo (Header) */
.top-bar {
    height: 60px;
    background-color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-dark);
}

.btn-logout {
    color: var(--titulo-escuro);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--titulo-escuro);
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: var(--titulo-escuro);
    color: white;
}

/* Sistema de Abas */
.tabs-container {
    background-color: #e0e0e0;
    display: flex;
    gap: 2px;
    padding: 10px 10px 0 10px;
    overflow-x: auto;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
}

.tab {
    padding: 8px 15px;
    background-color: #d1d1d1;
    color: #666;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    transition: background 0.2s;
    min-width: 120px;
    justify-content: space-between;
}

.tab:hover {
    background-color: #ddd;
}

.tab.active {
    background-color: var(--white);
    color: var(--titulo-escuro);
    font-weight: 600;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

.tab-close {
    font-size: 1.1rem;
    line-height: 10px;
    color: #999;
}

.tab-close:hover {
    color: #d32f2f;
}

/* Área onde as páginas carregam */
.tab-content-area {
    flex: 1; /* Cresce para ocupar o resto da tela */
    position: relative;
    background-color: var(--white);
    overflow: hidden; /* Iframe controla o scroll interno */
    display: flex; /* Necessário para o iframe esticar */
}

.tab-pane {
    display: none;
    width: 100%;
    height: 100%; /* Estica o iframe */
    border: none;
}

.tab-pane.active {
    display: block;
}

.arrow {
    font-size: 0.8rem;
    transition: transform 0.3s;
}
.menu-btn[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}
/* --- ESTILOS DE LISTAGEM, BUSCA E PAGINAÇÃO --- */

/* Barra Superior (Botão Novo + Busca) */
.barra-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-novo {
    background-color: #28a745; /* Verde para ação de criar */
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s;
    border: none;
    font-size: 0.9rem;
}

.btn-novo:hover {
    background-color: #218838;
}

.filtro-busca {
    display: flex;
    gap: 5px;
    flex: 1;
    max-width: 400px;
}

.filtro-busca input {
    padding: 10px;
    border: 1px solid var(--rosa-suave);
    border-radius: 8px;
    flex: 1;
}

.filtro-busca button {
    background-color: var(--titulo-escuro);
    color: white;
    border: none;
    padding: 0 15px;
    border-radius: 8px;
    cursor: pointer;
}

/* Tabela Ajustada */
.tabela-container {
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--rosa-suave);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--rosa-suave); /* Cabeçalho levemente rosa */
    color: var(--titulo-escuro);
    padding: 12px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background-color: #fff0f5; /* Efeito hover rosa bem clarinho */
}

/* Paginação (Rodapé) */
.paginacao {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.paginacao a {
    padding: 8px 12px;
    border: 1px solid var(--rosa-suave);
    text-decoration: none;
    color: var(--titulo-escuro);
    border-radius: 5px;
    background: white;
    transition: all 0.2s;
}

.paginacao a:hover {
    background-color: var(--primary-pink);
    color: white;
    border-color: var(--primary-pink);
}

.paginacao a.ativo {
    background-color: var(--titulo-escuro);
    color: white;
    border-color: var(--titulo-escuro);
}