/* --- IMPORTAÇÃO DA GOOGLE FONT (INTER) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- 1. ESTILOS DE LOGIN --- */
body { 
    font-family: 'Inter', sans-serif; 
    margin: 0; 
}
.body-login { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    background-color: #e2e8f0; 
    font-family: 'Inter', sans-serif;
    margin: 0;
}
.login-card { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 350px; }
.login-card h2 { margin-top: 0; color: #1e293b; }
.login-card input { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #cbd5e1; border-radius: 4px; box-sizing: border-box; }
.login-card button { width: 100%; padding: 10px; background: #3b82f6; color: white; border: none; border-radius: 4px; cursor: pointer; }
.erro-box { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 4px; margin-bottom: 15px; }
.info-footer { font-size: 12px; color: #64748b; margin-top: 15px; text-align: center; }

/* --- 2. LAYOUT BASE DO ADMIN --- */
.body-admin { 
    background-color: #e2e8f0; 
    padding: 20px; 
    min-height: 100vh; 
    font-family: 'Inter', sans-serif;
    margin: 0;
}

/* --- 3. NAMESPACE DMS (Tudo dentro do painel) --- */
.dms-container { max-width: 900px; margin: 0 auto; }

/* Cabeçalho Padronizado */
.dms-container .header-painel { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 20px 25px; 
    background: #fff; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.header-titulos h2 { margin: 0; color: #1e293b; font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.header-titulos small { color: #64748b; font-size: 13px; display: block; margin-top: 4px; }

.header-acoes { display: flex; gap: 10px; align-items: center; }

/* Botões do Cabeçalho */
.btn-header {
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: 0.2s;
    border: 1px solid transparent;
}
.btn-h-azul { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.btn-h-azul:hover { background: #dbeafe; }

.btn-h-verde { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.btn-h-verde:hover { background: #d1fae5; }

.btn-h-cinza { background: #f8fafc; color: #334155; border-color: #e2e8f0; }
.btn-h-cinza:hover { background: #f1f5f9; }

.btn-sair { background: #ef4444; color: #fff; padding: 8px 18px; border-radius: 6px; font-weight: 600; text-decoration: none; transition: 0.2s; font-size: 14px; }
.btn-sair:hover { background: #dc2626; }
/* Formulário de Busca */
.dms-container .form-busca { display: flex; flex-direction: column; gap: 15px; background: #f8fafc; padding: 20px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 25px; }
.dms-container .btn-busca { padding: 10px 20px; background: #3b82f6; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; }

/* Caixa de Cadastro (Usada no Upload.php) */
.dms-container .box-cadastro { background: #fff; padding: 25px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 20px; }

/* Estilo unificado para Labels, Inputs, Selects e Textareas do DMS */
.dms-container label { display: block; font-weight: bold; color: #334155; margin-bottom: 5px; font-size: 14px; margin-top: 10px; }
.dms-container input[type="text"], 
.dms-container input[type="date"], 
.dms-container select, 
.dms-container textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #cbd5e1; 
    border-radius: 4px; 
    box-sizing: border-box; 
    font-size: 14px; 
    font-family: inherit;
}

/* Botões de Ação */
.btn-verde { background: #10b981; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-verde:hover { background: #059669; }

/* --- 4. LISTAGEM DE DOCUMENTOS (Busca e Consulta) --- */

/* Barra de Ações em Massa */
.barra-acoes-massa { margin: 20px 0; display: flex; justify-content: space-between; align-items: center; background: #e2e8f0; padding: 10px 15px; border-radius: 5px; }
.btn-excluir-massa { display: none; background: #ef4444; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-excluir-massa:hover { background: #dc2626; }

/* Card do Documento */
.dms-container .card-doc { display: flex; gap: 15px; align-items: flex-start; background: #fff; padding: 15px; border-radius: 8px; border: 1px solid #e2e8f0; margin-bottom: 10px; transition: box-shadow 0.2s; }
.dms-container .card-doc:hover { box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

/* Container do Checkbox */
.check-wrapper { padding-top: 5px; }
.check-doc { width: 18px; height: 18px; cursor: pointer; }

/* Título e Meta Informações */
/* O peso foi configurado para 500 (Medium) para um aspecto elegante e equilibrado */
.dms-container .titulo-doc { font-size: 15px; color: #1e293b; margin: 0; font-weight: 500; letter-spacing: 0.1px; }
.dms-container .meta-info { font-size: 13px; color: #475569; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }

/* Etiquetas (Tags) de Categoria e Secretaria */
.tag-categoria { background: #e2e8f0; padding: 3px 8px; border-radius: 4px; color: #334155; font-weight: bold; }
.tag-secretaria { background: #fef08a; padding: 3px 8px; border-radius: 4px; color: #854d0e; font-weight: bold; }

/* Botões Internos do Card (Editar/Download) */
.acoes-doc { margin-left: auto; display: flex; gap: 15px; align-items: center; }
.btn-acao-editar { color: #3b82f6; font-weight: bold; text-decoration: none; transition: 0.2s; }
.btn-acao-editar:hover { color: #2563eb; text-decoration: underline; }
.btn-acao-download { color: #10b981; font-weight: bold; text-decoration: none; transition: 0.2s; }
.btn-acao-download:hover { color: #059669; text-decoration: underline; }

/* --- 5. PAGINAÇÃO --- */
.paginacao { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.btn-pagina { padding: 8px 12px; background: #f1f5f9; color: #334155; text-decoration: none; border-radius: 4px; font-weight: bold; transition: 0.2s; }
.btn-pagina:hover { background: #e2e8f0; }
.btn-pagina.ativa { background: #3b82f6; color: white; }

/* Alertas de Sucesso/Erro */
.alerta { padding: 15px; margin-bottom: 20px; border-radius: 4px; font-weight: bold; text-align: center; }
.sucesso { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.erro { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }


/* --- 6. SISTEMA VISUAL DE TAGS (Upload e Edição) --- */
.tags-container { display: flex; flex-wrap: wrap; align-items: center; width: 100%; padding: 5px; border: 1px solid #cbd5e1; border-radius: 4px; box-sizing: border-box; background: #fff; margin-bottom: 15px; min-height: 44px; }
.tags-container ul { display: flex; flex-wrap: wrap; padding: 0; margin: 0; list-style: none; gap: 6px; }
.tags-container ul li { background-color: #e2e8f0; color: #334155; border-radius: 4px; padding: 5px 10px; font-size: 13px; display: flex; align-items: center; font-weight: 600; }
.tags-container ul li span { margin-left: 8px; color: #94a3b8; cursor: pointer; font-weight: bold; transition: color 0.2s; }
.tags-container ul li span:hover { color: #ef4444; }
.tags-container input { flex: 1; border: none; outline: none; padding: 5px; font-size: 14px; min-width: 150px; background: transparent; }


/* =========================================
   ESTILOS DO PAINEL ADMIN E DASHBOARD
   ========================================= */
.dashboard-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 25px; }
.card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); text-align: center; border-top: 4px solid #3b82f6; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.card h3 { margin: 0 0 5px 0; font-size: 32px; color: #1e293b; border: none; }
.card p { margin: 0; color: #64748b; font-weight: bold; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }

/* Alinhamento dos Botões no Cabeçalho */
.header-acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.header-acoes a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 8px 15px; text-decoration: none; border-radius: 4px; font-size: 14px; font-weight: bold; }

/* Abas */
.abas-container { display: flex; gap: 4px; margin: 25px 0 0 0; border-bottom: 2px solid #e2e8f0; flex-wrap: wrap; }
.tab-botao { background: #f8fafc; color: #64748b; padding: 12px 20px; border: 1px solid #e2e8f0; border-bottom: none; border-radius: 8px 8px 0 0; cursor: pointer; font-weight: bold; font-size: 13px; }
.tab-botao.ativa { background: #fff; color: #2563eb; border: 2px solid #e2e8f0; border-bottom: 2px solid #fff; position: relative; top: 2px; z-index: 2; }
.tab-conteudo { display: none; }
.tab-conteudo.ativa { display: block; }
.box-conteudo-aba { background: #fff; padding: 30px; border-radius: 0 8px 8px 8px; border: 2px solid #e2e8f0; }

/* Formulários Admin */
.form-max-width { max-width: 500px; margin: 0 auto; }
.form-max-width label { font-weight: bold; color: #334155; margin-bottom: 6px; display: block; font-size: 13px; }
.form-max-width input, .form-max-width select { width: 100%; box-sizing: border-box; margin-bottom: 15px; padding: 10px; border: 1px solid #cbd5e1; border-radius: 4px; }

/* Tabelas e Botões de Ação */
.tabela-alinhada { width: 100%; border-collapse: collapse; margin-top: 10px; }
.tabela-alinhada th, .tabela-alinhada td { padding: 12px; border-bottom: 1px solid #e2e8f0; text-align: left; }
.btn-permissoes { display: inline-block; margin-top: 8px; font-size: 11px; background: #f59e0b; color: white; padding: 6px 10px; border-radius: 4px; text-decoration: none; font-weight: bold; }
.btn-permissoes:hover { background: #d97706; }
.btn-acao-azul { background: #3b82f6; color: #fff; padding: 6px 12px; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 12px; margin-right: 4px; }
.btn-acao-azul:hover { background: #2563eb; }
.btn-acao-vermelho { background: #ef4444; color: #fff; padding: 6px 12px; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 12px; }
.btn-acao-vermelho:hover { background: #dc2626; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
.modal-content { background: white; padding: 25px; border-radius: 8px; width: 90%; max-width: 400px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.modal-content h3 { margin-top: 0; color: #1e293b; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 15px;}
.acoes-modal-botoes { display: flex; gap: 10px; }
.btn-modal-cancelar { flex: 1; padding: 10px; border: 1px solid #cbd5e1; background: white; border-radius: 4px; cursor: pointer; font-weight: bold; color: #475569; }
.btn-modal-cancelar:hover { background: #f1f5f9; }
.btn-modal-salvar { flex: 1; padding: 10px; border: none; background: #3b82f6; color: white; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-modal-salvar:hover { background: #2563eb; }

/* =========================================
   MENU DROPDOWN (SUSPENSO)
   ========================================= */
.dropdown { position: relative; display: inline-block; }
.dropbtn { cursor: pointer; font-family: inherit; } 
.dropdown-content { 
    display: none; 
    position: absolute; 
    background-color: #ffffff; 
    min-width: 180px; 
    box-shadow: 0px 8px 16px rgba(0,0,0,0.15); 
    z-index: 9999; /* Aumentado para garantir que fique acima de tudo */
    border-radius: 6px; 
    border: 1px solid #cbd5e1; 
    top: 100%; 
    left: 0; 
    /* margin-top removido para colar o menu no botão e eliminar a zona morta */
    overflow: hidden; 
}
.dropdown-content a { 
    color: #334155; 
    padding: 12px 16px; 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 13px; 
    border-bottom: 1px solid #f1f5f9; 
    font-weight: bold; 
}
.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: #f8fafc; color: #2563eb; }
.dropdown:hover .dropdown-content { display: block; }


/* --- ESTILOS UNIFICADOS PARA CADASTROS --- */
.box-cadastro { 
    background: #ffffff; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    margin-top: 20px; 
}

.input-padrao { 
    width: 100%; 
    padding: 10px; 
    margin-bottom: 15px; 
    border: 1px solid #cbd5e1; 
    border-radius: 4px; 
    box-sizing: border-box; 
}

.label-padrao { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
    color: #334155; 
    font-size: 14px; 
}

.alerta { padding: 15px; border-radius: 4px; margin-bottom: 20px; font-weight: bold; }
.alerta.erro { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alerta.sucesso { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }


/* --- ESTILOS COMPLEMENTARES DE FORMULÁRIO --- */
.input-padrao:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.msg-erro-campo { color: #ef4444; font-weight: bold; font-size: 12px; display: none; margin-top: -10px; margin-bottom: 15px; }
.radio-group { display: flex; gap: 20px; margin-bottom: 15px; align-items: center; background: #f8fafc; padding: 12px; border: 1px solid #cbd5e1; border-radius: 4px; }
.radio-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #334155; font-weight: 600; font-size: 14px; }
.radio-group input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: #3b82f6; }


/* --- LISTAGEM DE ITENS (Cadastros Base) --- */
.lista-items { margin-top: 30px; background: #ffffff; padding: 25px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.item { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.item:last-child { border-bottom: none; }
.item:hover { background-color: #f8fafc; }
.item-id { color: #94a3b8; font-size: 0.85em; background: #f1f5f9; padding: 2px 8px; border-radius: 12px; margin-left: 8px; }
.btn-acao-editar { background-color: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; }
.btn-acao-editar:hover { background-color: #dbeafe; }
.btn-acao-excluir { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; margin-left: 5px; }
.btn-acao-excluir:hover { background-color: #fee2e2; }
