/*
 * =================================================================
 * ARQUITETURA DE TEMA COM VARIÁVEIS CSS (CUSTOM PROPERTIES)
 * =================================================================
 * Esta abordagem centraliza todas as cores do tema em variáveis CSS.
 * - ':root' define as variáveis para o tema padrão (claro).
 * - 'body.dark-mode' sobrescreve essas variáveis quando o tema escuro está ativo.
 * Isso torna a manutenção e a criação de novos temas muito mais simples e organizadas,
 * atendendo ao requisito de "Implementar sistema de temas".
*/

/* Define as variáveis de cor para o tema claro (padrão) */
:root {
    --bg-primary: #f0f4f8;
    --text-primary: #334155;
    --text-title: #1e293b;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --btn-primary-bg: #6366f1;
    --btn-primary-hover-bg: #4f46e5;
    --btn-primary-text: white;
    --btn-secondary-bg: #e2e8f0;
    --btn-secondary-hover-bg: #cbd5e0;
    --btn-secondary-text: #475569;
    --highlight-bg: #e0f2f7;
    --highlight-text: #2c5282;
    --bubble-bg: #a78bfa;
    --trevo-bubble-bg: #34d399;
    --border-color: #e2e8f0;
    --dashed-border-color: #d1d5db; /* Cor para bordas tracejadas */
    --table-header-bg: #f8fafc;
    --modal-bg: #fefefe;
    --text-muted: #6b7280; /* Cor para textos secundários/placeholders */
    --input-bg: white;
    --input-border: #d1d5db;
    --input-text: #111827;
    --icon-color: #9ca3af; /* Cor para ícones de informação */
}

/* Sobrescreve as variáveis para o tema escuro */
body.dark-mode {
    --bg-primary: #1a202c;
    --text-primary: #e2e8f0;
    --text-title: #ffffff;
    --card-bg: #2d3748;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --btn-primary-bg: #818cf8;
    --btn-primary-hover-bg: #6366f1;
    --btn-secondary-bg: #4a5568;
    --btn-secondary-hover-bg: #64748b;
    --btn-secondary-text: #cbd5e0;
    --highlight-bg: #2a4365;
    --highlight-text: #e0f2f7;
    --bubble-bg: #c4b5fd;
    --trevo-bubble-bg: #6ee7b7;
    --border-color: #4a5568;
    --dashed-border-color: #6b7280;
    --table-header-bg: #2d3748;
    --modal-bg: #2d3748;
    --text-muted: #9ca3af;
    --input-bg: #4a5568;
    --input-border: #6b7280;
    --input-text: #e2e8f0;
    --icon-color: #cbd5e0;
}

/* Estilos base que utilizam as variáveis de tema */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

body.modal-open {
    overflow-y: hidden;
}

.main-title {
     color: var(--text-title);
}

.container-card {
    background-color: var(--card-bg);
    box-shadow: 0 4px 6px var(--card-shadow);
    transition: background-color 0.3s, box-shadow 0.3s;
}

small, .text-muted {
    color: var(--text-muted);
}

p.text-gray-500 {
    color: var(--text-muted);
}

.button-primary {
    background-color: var(--btn-primary-bg); 
    color: var(--btn-primary-text);
}
.button-primary:hover {
    background-color: var(--btn-primary-hover-bg);
}

.button-secondary {
    background-color: var(--btn-secondary-bg); 
    color: var(--btn-secondary-text);
}
.button-secondary:hover {
    background-color: var(--btn-secondary-hover-bg);
}

.btn-modern {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
}
.btn-modern:hover {
    transform: translateY(-2px);
}
.btn-modern:active {
    transform: translateY(0);
}

.highlight-rectangle {
    background-color: var(--highlight-bg); 
    color: var(--highlight-text); 
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem; 
    font-weight: 600; 
    display: inline-block; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.number-bubble, .trevo-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem; 
    height: 2.5rem; 
    border-radius: 50%;
    color: white;
    font-weight: bold;
    margin: 0.25rem; 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem; 
    line-height: 1.25rem; 
}
.number-bubble {
    background-color: var(--bubble-bg); 
}
.trevo-bubble { 
    background-color: var(--trevo-bubble-bg);
}

@media (max-width: 640px) { 
    .number-bubble, .trevo-bubble {
        width: 2.2rem; 
        height: 2.2rem;
        font-size: 0.8rem;
    }
}

/* Inputs e Selects */
select, input[type="text"], input[type="number"], input[type="checkbox"] {
    background-color: var(--input-bg);
    border-color: var(--input-border) !important; /* Tailwind override */
    color: var(--input-text);
}
input[type="text"]::placeholder {
    color: var(--text-muted);
}

.border { border-color: var(--input-border) !important; }
.border-dashed { border-color: var(--dashed-border-color) !important; }

.table-auto {
    width: 100%;
    border-collapse: collapse;
}
.table-auto th, .table-auto td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.table-auto th {
    background-color: var(--table-header-bg);
    font-weight: 600;
}

.fa-info-circle {
    color: var(--icon-color);
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: flex; 
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: var(--modal-bg);
    margin: auto;
    padding: 20px;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.close-button {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close-button:hover,
.close-button:focus {
    color: var(--text-title);
    text-decoration: none;
    cursor: pointer;
}

.hidden { 
    display: none !important; 
}

.most-frequent-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.federal-number-block {
    font-size: 1.5rem; 
    font-weight: bold;
    color: var(--text-primary);
    margin: 0.5rem 0;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    display: inline-block;
    background-color: var(--table-header-bg);
}