/* ========================================
   Dados Brasil V2 - Search-First Hub
   Padrão ECST Bloomberg
   ======================================== */

/* === Barra de Busca Principal === */
#search-input {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e5e5;
    transition: all 0.3s ease;
}

#search-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.1);
}

#search-button {
    padding: 0.75rem 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    border: none;
    transition: all 0.3s ease;
}

#search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* === Quick Access Chips === */
.btn-group .btn-light {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}

.btn-group .btn-light:hover {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
    transform: translateY(-1px);
}

/* === Cards de Resultados === */
.series-card {
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    background: white;
}

.series-card:hover {
    border-color: #0066cc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.series-card h6 {
    color: #212529;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.series-card .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

/* === Sparkline Graph === */
.series-card .graph-container {
    height: 40px;
    overflow: hidden;
}

/* === Facetas/Filtros === */
#filter-source label,
#filter-category label,
#filter-frequency label,
#filter-unit label {
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
    transition: color 0.2s ease;
}

#filter-source label:hover,
#filter-category label:hover,
#filter-frequency label:hover,
#filter-unit label:hover {
    color: #0066cc;
}

.form-check-input:checked {
    background-color: #0066cc;
    border-color: #0066cc;
}

/* === Comparador === */
#compare-list {
    max-height: 200px;
    overflow-y: auto;
}

#compare-list .compare-item {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.875rem;
}

#compare-list .compare-item:last-child {
    border-bottom: none;
}

/* === Drawer de Série === */
#series-drawer {
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

#series-drawer h4 {
    color: #212529;
    font-weight: 600;
    margin-bottom: 1rem;
}

#series-drawer .badge {
    font-size: 0.8rem;
    font-weight: 500;
}

/* === Modal Comparador === */
#compare-modal .modal-content {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

#compare-modal .modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
}

#compare-modal .modal-dialog {
    max-width: 900px;
}

/* === Card Comparador === */
#compare-list {
    min-height: 100px;
}

#compare-list:empty::after {
    content: "Nenhuma série selecionada";
    color: #6c757d;
    font-size: 0.875rem;
    display: block;
    text-align: center;
    padding: 2rem;
}

/* Botão comparar nos cards */
button[id*="compare-series"] {
    transition: all 0.2s ease;
}

button[id*="compare-series"]:hover {
    background-color: #0066cc !important;
    border-color: #0066cc !important;
    color: white !important;
    transform: translateY(-1px);
}

button[id*="compare-series"].active {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

/* === Loading States === */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Responsive Design === */
@media (max-width: 768px) {
    #search-input {
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .series-card h6 {
        font-size: 0.9rem;
    }
    
    #series-drawer {
        width: 90% !important;
    }
}

/* === Animações === */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.text-muted {
    color: #6c757d !important;
    font-size: 0.875rem;
}

/* === Key BR Badge === */
.badge.bg-warning.text-dark {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%) !important;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
}

/* === Cards de Coleções Temáticas === */
.collection-card {
    transition: all 0.3s ease;
    border-width: 2px;
    min-height: 180px;
    cursor: pointer;
}

.collection-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.collection-card.border-danger:hover {
    border-color: #dc3545 !important;
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.2);
}

.collection-card.border-success:hover {
    border-color: #28a745 !important;
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.2);
}

.collection-card.border-info:hover {
    border-color: #17a2b8 !important;
    box-shadow: 0 8px 20px rgba(23, 162, 184, 0.2);
}

.collection-card.border-primary:hover {
    border-color: #007bff !important;
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.2);
}

.collection-card.border-warning:hover {
    border-color: #ffc107 !important;
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.2);
}

.collection-card.border-secondary:hover {
    border-color: #6c757d !important;
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.2);
}

.collection-card.border-light:hover {
    border-color: #0066cc !important;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.2);
}

.collection-card.border-dark:hover {
    border-color: #343a40 !important;
    box-shadow: 0 8px 20px rgba(52, 58, 64, 0.2);
}

.collection-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

/* === Filtros Modernos === */
.filter-checklist-modern .form-check {
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.filter-checklist-modern .form-check:hover {
    background-color: #f8f9fa;
}

.filter-checklist-modern .form-check-input {
    margin-top: 0.25rem;
    cursor: pointer;
}

.filter-checklist-modern .form-check-input:checked {
    background-color: #0066cc;
    border-color: #0066cc;
}

.filter-checklist-modern .form-check-label {
    width: 100%;
    cursor: pointer;
    margin-left: 0.5rem;
}

.filter-radio-modern .form-check {
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.filter-radio-modern .form-check:hover {
    background-color: #f8f9fa;
}

.filter-radio-modern .form-check-input:checked + .form-check-label {
    color: #0066cc;
    font-weight: 600;
}

/* Accordion customizado */
.accordion-button {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background-color: white;
    color: #495057;
    font-weight: 500;
    border: none;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background-color: #f8f9fa;
    color: #0066cc;
    border-bottom: 2px solid #0066cc;
}

.accordion-button::after {
    background-size: 1rem;
    width: 1rem;
    height: 1rem;
}

.accordion-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-body {
    padding: 0.75rem 0.5rem;
}

/* Badges nos filtros */
.filter-checklist-modern .badge,
.filter-radio-modern .badge {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    font-weight: normal;
    padding: 0.25rem 0.5rem;
}

.filter-checklist-modern .form-check-input:checked ~ .form-check-label .badge,
.filter-radio-modern .form-check-input:checked ~ .form-check-label .badge {
    background-color: #0066cc !important;
    color: white !important;
}

/* === Cards de Indicadores Principais === */
button[id*="key-indicator-card"] {
    transition: all 0.3s ease !important;
    border-radius: 8px !important;
}

button[id*="key-indicator-card"]:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.15) !important;
}

button[id*="key-indicator-card"]:hover .card {
    border-color: #0066cc !important;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.1) !important;
}

button[id*="key-indicator-card"]:active {
    transform: translateY(-1px) !important;
}

/* === Paginação === */
.pagination {
    flex-wrap: wrap !important; /* Permite quebrar linha se precisar */
    gap: 4px !important; /* Espaço entre botões */
    margin: 15px 0 !important;
    justify-content: center !important;
    max-width: 100% !important; /* Não estoura o container */
}

.pagination .page-link {
    padding: 4px 8px !important; /* Reduz o padding */
    font-size: 0.85rem !important; /* Texto menor */
    min-width: 32px !important; /* Largura mínima para botões */
    text-align: center !important;
    color: #495057;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    color: #0066cc;
    background-color: #f8f9fa;
    border-color: #0066cc;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background-color: #0066cc !important;
    border-color: #0066cc !important;
    color: white !important;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

/* --- Paginação: impedir esticamento vertical --- */
#pagination {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;     /* NÃO esticar verticalmente */
    align-content: center !important;
    justify-content: center !important;
    gap: 4px !important;
    height: auto !important;
    max-height: none !important;
    line-height: 1 !important;
}

#pagination > li.page-item {
    display: inline-flex !important;
    align-items: center !important;
    height: auto !important;
    flex: 0 0 auto !important;          /* não crescer/encolher */
}

#pagination > li.page-item > a.page-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;            /* força altura "normal" */
    min-height: 32px !important;
    max-height: 32px !important;
    line-height: 1.2 !important;
    padding: 4px 8px !important;
}

/* Trava geral para NUNCA subir para 1084px */
#pagination, #pagination * {
    max-height: 40px !important;        /* trava geral para não subir para 1084px */
    box-sizing: border-box !important;
}

/* Nuclear option: força altura em TODOS os elementos */
#pagination-container {
    height: auto !important;
    max-height: 60px !important;
    overflow: visible !important;
}

#pagination-container * {
    height: auto !important;
    max-height: 40px !important;
}

/* Específico para links - força altura fixa definitiva */
.page-link {
    height: 32px !important;
    max-height: 32px !important;
    min-height: 32px !important;
    line-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 0 8px !important;
}