html { overflow-y: scroll; }
:root {
    --primary: #4CAF50;
    --primary-hover: #45a049;
    --error: #f44336;
    --error-hover: #da190b;
    --fixed-button: #333;
    --fixed-button-hover: #555;
    --background-light: #f5f5f5;
    --text-dark: #333;
    --background-dark: #1a1a1a;
    --text-light: #f0f0f0;
    --section-light: white;
    --section-dark: #2a2a2a;
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-dark: rgba(255,255,255,0.1);
    --table-header-light: #f2f2f2;
    --table-header-dark: #3a3a3a;
    --border-dark: #444;
    --legenda-light: #666;
    --legenda-dark: #bbb;
}
body { font-family: Arial, sans-serif; padding: 20px; background-color: var(--background-light); transition: background-color 0.3s, color 0.3s; }
h2, h3, h4 { color: var(--text-dark); font-size: 24px; margin: 0 0 10px 0; font-weight: normal; }
.container { max-width: 1000px; margin: 0 auto; position: relative; }
.section { background-color: var(--section-light); padding: 15px; border-radius: 5px; box-shadow: 0 2px 4px var(--shadow-light); margin-bottom: 20px; transition: background-color 0.3s; position: relative; z-index: 1; }
.section span { font-size: 16px; color: var(--text-dark); }
.header { text-align: center; position: relative; z-index: 2; }
.header .title { font-size: 28px; margin-bottom: 0.1rem; }
.header .fixed-text { font-size: 18px; }
.header .dates { font-size: 18px; white-space: nowrap; }
.header .link { font-size: 18px; margin-bottom: 0.3rem; }
.header .date { font-size: 24px; }
.botoes { margin: 10px 0; }
button { padding: 8px 16px; background-color: var(--primary); color: white; border: none; cursor: pointer; margin-right: 10px; font-size: 14px; border-radius: 5px; }
button:hover { background-color: var(--primary-hover); }
#limpar { background-color: var(--error); }
#limpar:hover { background-color: var(--error-hover); }
#conteudo h3 { margin-bottom: 0; font-weight: normal; }
.colunas { display: flex; flex-wrap: wrap; gap: 10px; }
.coluna { flex: 1; min-width: 150px; }
.coluna h4 { font-size: 16px; line-height: 1.2; font-weight: normal; }
.coluna p { color: var(--text-dark); }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; color: var(--text-dark); }
th { background-color: var(--table-header-light); font-weight: bold; }
.filtros { margin: 10px 0; position: relative; z-index: 1; }
#loading { display: none; text-align: center; margin: 10px 0; }
.mensagem-erro { display: inline-block; color: white; background-color: var(--error); padding: 5px 12px; border-radius: 3px; white-space: nowrap; }
.loading-spinner { font-size: 16px; color: var(--text-dark); }
.resultados-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.resultados-titulo { display: block; }
.resultados-titulo button { margin-top: 10px; }
.leilao { color: red !important; display: inline; margin: 0; padding: 0; }
.vermelho { color: red !important; }
.header a { color: var(--text-dark); text-decoration: underline; }
.header a:hover { color: var(--primary); }
.legenda { font-style: italic; color: var(--legenda-light); }
.arquivos-linha { margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.botao-fixo {
    position: fixed;
    right: 10px;
    background-color: var(--fixed-button);
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    z-index: 1000;
    display: flex;
    align-items: center;
    width: 80px;
    box-sizing: border-box;
    justify-content: center;
}
.botao-fixo:hover { background-color: var(--fixed-button-hover); }
.botao-fixo i { margin-right: 5px; }
#temaBtn { top: 10px; }
#whoisBtn { top: 45px; }
#inpiBtn { top: 80px; }
#logoutBtn { top: 115px; }
#voltarTopo {
    position: fixed;
    bottom: 20px;
    right: calc((100% - 1000px) / 2 + 20px);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    background-color: var(--fixed-button);
    color: var(--text-light);
    overflow: hidden;
}
#voltarTopo i {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}
.dark-theme #voltarTopo {
    background-color: #444;
    color: var(--text-light);
}
body.dark-theme { background-color: var(--background-dark); color: var(--text-light); }
.dark-theme .section { background-color: var(--section-dark); box-shadow: 0 2px 4px var(--shadow-dark); }
.dark-theme h2, .dark-theme h3, .dark-theme h4, .dark-theme .header a,
.dark-theme .section span, .dark-theme .coluna p, .dark-theme th, .dark-theme td {
    color: var(--text-light);
}
.dark-theme .leilao { color: red !important; }
.dark-theme .vermelho { color: red !important; }
.dark-theme th { background-color: var(--table-header-dark); }
.dark-theme td { border-bottom: 1px solid var(--border-dark); }
.dark-theme .legenda { color: var(--legenda-dark); }
.dark-theme .loading-spinner { color: var(--text-light); }
.dark-theme #contadorCaracteres { color: var(--legenda-dark); }

input[type="checkbox"] {
    accent-color: #007bff;
}

input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="text"] { padding: 6px; font-size: 14px; border: 1px solid #ddd; border-radius: 3px; width: 200px; margin-left: 5px; }
input[type="text"]:disabled { opacity: 0.5; cursor: not-allowed; }
#palavraEspecifica:focus { border: 2px solid var(--primary); outline: none; }
.filtros h4 { font-size: 18px; margin: 10px 0 5px 0; }
#contadorCaracteres { font-size: 12px; color: var(--legenda-light); margin-left: 10px; }
#conteudo { margin-top: 20px; position: relative; }

@media (max-width: 1000px) {
    #voltarTopo { right: 20px; }
}

@media (max-width: 600px) {
    .colunas { flex-direction: column; }
    .coluna { min-width: 100%; }
    .botao-fixo { width: 100px; padding: 10px; font-size: 16px; }
    #temaBtn { top: 10px; }
    #whoisBtn { top: 45px; }
    #inpiBtn { top: 80px; }
    #logoutBtn { top: 115px; }
    #voltarTopo { width: 40px; height: 40px; font-size: 16px; right: 20px; }
    h2, h3, h4 { font-size: 20px; }
    .section span, .coluna p, th, td { font-size: 14px; }
    table { width: 100%; overflow-x: auto; }
    .header .title { font-size: 24px; }
    .header .fixed-text { font-size: 16px; white-space: nowrap; }
    .header .dates { font-size: 16px; white-space: nowrap; }
    .header .link { font-size: 16px; white-space: nowrap; }
    .header .date { font-size: 20px; }
    .toggle-icon { font-size: 20px; }
}

@media (max-width: 600px) and (orientation: portrait) {
    #temaBtn { top: 10px; }
    #whoisBtn { top: 50px; }
    #inpiBtn { top: 90px; }
    #logoutBtn { top: 130px; }
}

.section.collapsed .section-content {
    max-height: 0;
    transform: scaleY(0);
    transform-origin: top;
    overflow: hidden;
    opacity: 0.5;
    transition: transform 0.25s ease, max-height 0.25s ease, opacity 0.25s ease;
}

.section-content {
    max-height: 2000px;
    transform: scaleY(1);
    transform-origin: top;
    overflow: hidden;
    opacity: 1;
    transition: transform 0.25s ease, max-height 0.25s ease, opacity 0.25s ease;
}

.section.collapsed {
    padding: 15px;
    min-height: 30px;
}

.toggle-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-dark);
    transition: transform 0.25s ease;
}

.dark-theme .toggle-icon {
    color: var(--text-light);
}

.toggle-icon.collapsed {
    transform: rotate(180deg);
}

.section-header {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header .section-header {
    margin-bottom: 0.3rem;
    justify-content: center;
}

#arquivosSection .section-header {
    margin-bottom: 10px;
}

.section-header h2 {
    margin: 0;
    font-size: 24px;
    text-align: left;
}

.header .section-header .title {
    text-align: center;
}
