/* routrell-analytics-history.css */

/* ============================================
   HISTORY PAGE - MAIN CONTAINER
   ============================================ */

#routrell-analytics-history {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.history-page-header {
    margin-bottom: 30px;
}

.page-title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title-section > i {
    font-size: 32px;
    color: var(--primary);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin: 5px 0 0 0;
}

/* ============================================
   COMPARISON TYPE TABS
   ============================================ */

.comparison-type-section {
    margin-bottom: 30px;
}

.comparison-type-tabs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Ajuste para usar o tamanho total da tela */
.comparison-type-tabs.full-width-tabs {
    display: flex;
    gap: 15px;
    width: 100%;
}

.comparison-type-tabs.full-width-tabs .comparison-tab {
    flex: 1;
    justify-content: center;
}

.comparison-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.comparison-tab:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.comparison-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.comparison-tab i {
    font-size: 18px;
}

/* ============================================
   FILTERS SECTION
   ============================================ */

.filters-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    transition: all 0.4s ease-in-out;
}

.filters-section.hidden {
    display: none;
}

/* Wrapper e Sumário para recolhimento suave */
.filters-collapsible-wrapper {
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out;
}

.filters-section.collapsed .filters-collapsible-wrapper {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.filters-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
}

.summary-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 500;
}

.summary-info i {
    color: var(--primary);
}

.btn-edit-filters {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: start;
}

.filters-grid.single-column {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
}

/* NOVO: Ajuste para Evolução Individual ocupar 100% com centralização dos selects */
.filters-grid-evolution-full {
    display: flex;
    justify-content: center;
    width: 100%;
}

.filters-grid-evolution-full .filter-card {
    width: 100%;
}

.filter-inputs-horizontal {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: flex-end;
    width: 100%;
}

.filter-inputs-horizontal .input-group {
    flex: 0 0 300px;
}

/* ============================================
   FILTER CARD
   ============================================ */

.filter-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.filter-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.filter-card-title i {
    color: var(--primary);
}

.filter-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group.hidden {
    display: none;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.input-hint {
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
    margin-top: -4px;
}

.filter-select,
.filter-input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select:disabled,
.filter-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border);
}

/* NOVO: Estilo para opções desabilitadas (bloqueio de membro) */
.filter-select option:disabled {
    color: var(--text-light);
    background: var(--border);
}

/* ============================================
   VS DIVIDER
   ============================================ */

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.vs-text {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50%;
}

/* ============================================
   FILTERS ACTIONS
   ============================================ */

.filters-actions {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.btn-compare {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-compare:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-compare:active {
    transform: translateY(0);
}

.btn-compare i {
    font-size: 18px;
}

/* ============================================
   INSIGHTS
   ============================================ */

.insights-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 8px;
}

.insight-card.success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.insight-card.warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.insight-card.alert {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.insight-card.info {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.insight-card.highlight {
    border-left-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.05);
}

.insight-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.insight-card.success .insight-icon {
    background: #d1fae5;
    color: #10b981;
}

.insight-card.warning .insight-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.insight-card.alert .insight-icon {
    background: #fee2e2;
    color: #ef4444;
}

.insight-card.info .insight-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.insight-card.highlight .insight-icon {
    background: #ede9fe;
    color: #8b5cf6;
}

.insight-content {
    flex: 1;
}

.insight-metric {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.insight-message {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

/* ============================================
   CHARTS GRID
   ============================================ */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

canvas {
    max-height: 400px;
}

/* ============================================
   METRICS COMPARISON
   ============================================ */

.metrics-comparison-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.section-subtitle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.section-subtitle i {
    color: var(--primary);
}

.metrics-comparison-grid {
    display: grid;
    gap: 20px;
}

.metric-comparison-row {
    display: grid;
    grid-template-columns: 200px 1fr 1fr 150px;
    gap: 20px;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.metric-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.metric-value {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.metric-value-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.metric-value-label {
    font-size: 12px;
    color: var(--text-light);
}

.metric-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.metric-change.positive {
    background: #d1fae5;
    color: #065f46;
}

.metric-change.negative {
    background: #fee2e2;
    color: #991b1b;
}

.metric-change.stable {
    background: var(--border);
    color: var(--text-light);
}

/* Dark mode adjustments */
[data-theme="dark"] .metric-change.positive {
    background: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .metric-change.negative {
    background: #7f1d1d;
    color: #fca5a5;
}

/* ============================================
   RESULTS SECTION
   ============================================ */

.results-section {
    animation: fadeIn 0.3s ease-in;
}

.results-section.hidden {
    display: none;
}

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

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state.hidden {
    display: none;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-light);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 10px 0;
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-state {
    text-align: center;
    padding: 80px 20px;
}

.loading-state.hidden {
    display: none;
}

.loading-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 20px;
}

.loading-text {
    font-size: 16px;
    color: var(--text);
    margin: 0;
}

/* Utilitários */
.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-comparison-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    #routrell-analytics-history {
        padding: 15px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .comparison-type-tabs {
        flex-direction: column;
    }
    
    .comparison-tab {
        width: 100%;
        justify-content: center;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .vs-divider {
        padding: 15px 0;
    }
    
    .vs-text {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .insights-container {
        grid-template-columns: 1fr;
    }

    /* Ajuste responsivo para os inputs horizontais */
    .filter-inputs-horizontal {
        flex-direction: column;
        align-items: stretch;
    }
}

