/**
 * Dashboard de Receita - Tema Claro
 * Adaptado do dashboard de referência com cores claras
 */

/********************************************
 * VARIÁVEIS
 ********************************************/
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --accent-green: #10b981;
    --accent-blue: #3b82f6;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
}

/********************************************
 * LAYOUT BASE
 ********************************************/
.dashboard.receita-dashboard {
    background-color: var(--bg-secondary);
    min-height: 100vh;
    padding: 20px;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
}

.page-title-left h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.page-title-left h2 i {
    color: var(--accent-green);
    margin-right: 10px;
}

/********************************************
 * FILTROS
 ********************************************/
.dashboard-filters {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.filters-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.filters-row {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.box-ano,
.box-mes,
.box-dia {
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
}

.box-ano {
    flex: 0.4;
    min-width: 100px;
}

.box-mes {
    flex: 1;
    min-width: 200px;
}

.box-dia {
    flex: 2.2;
    min-width: 380px;
}

.filter-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.filter-buttons-anos,
.filter-buttons-months,
.filter-buttons-days {
    display: grid;
    gap: 8px;
}

.filter-buttons-anos {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
}

.filter-buttons-months {
    grid-template-columns: repeat(6, 1fr);
}

.filter-buttons-days {
    grid-template-columns: repeat(16, 1fr);
}

.btn-year,
.btn-month,
.btn-day {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-year:hover,
.btn-month:hover,
.btn-day:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-year.active,
.btn-month.active,
.btn-day.active {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

/********************************************
 * CARDS DE MÉTRICAS
 ********************************************/
.cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 25px;
}

.card-metric {
    background-color: var(--bg-primary);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Cards clicáveis (todas categorias exceto TOTAL) */
.card-metric.card-clickable {
    cursor: pointer;
    position: relative;
}

.card-metric.card-clickable::after {
    content: '🔗';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.card-metric.card-clickable:hover::after {
    opacity: 0.5;
}

.card-metric.card-clickable:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-left-width: 6px !important;
}

.card-metric h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-metric h4 i {
    font-size: 0.9rem;
}

.card-metric .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-metric .count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Card TOTAL com destaque verde */
.card-metric.card-total {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.card-metric.card-total .value {
    color: #2e7d32;
}

.card-metric.card-total h4 {
    color: #388e3c;
}

/********************************************
 * GRÁFICOS
 ********************************************/
.charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.chart-box {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    flex: 1;
    min-height: 350px;
    box-shadow: var(--shadow-sm);
}

.chart-box.chart-wide {
    flex: 2;
    min-width: 60%;
}

.chart-box.chart-half {
    flex: 1 1 48%;
    min-width: 48%;
}

.chart-header h3 {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-content {
    height: 300px;
    width: 100%;
}

/********************************************
 * MENSAGEM SEM DADOS
 ********************************************/
.no-data-message {
    background-color: var(--bg-primary);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    width: 100%;
}

.no-data-message h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.no-data-message p {
    color: var(--text-muted);
}

/********************************************
 * ERROR ALERT
 ********************************************/
.error-alert {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.error-alert h2 {
    color: #b91c1c;
    margin-bottom: 10px;
}

.error-alert p {
    color: #dc2626;
    margin-bottom: 20px;
}

.btn-retry {
    background: var(--accent-red);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-retry:hover {
    background: #dc2626;
}

/********************************************
 * RESPONSIVIDADE
 ********************************************/
@media (max-width: 992px) {
    .filters-row {
        flex-direction: column;
        gap: 15px;
    }

    .box-ano,
    .box-mes,
    .box-dia {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .charts-row {
        flex-direction: column;
    }

    .chart-box,
    .chart-box.chart-wide,
    .chart-box.chart-half {
        min-width: 100%;
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .dashboard.receita-dashboard {
        padding: 10px;
    }

    .cards-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-metric {
        min-width: unset;
    }

    .filter-buttons-months {
        grid-template-columns: repeat(4, 1fr);
    }

    .filter-buttons-days {
        grid-template-columns: repeat(8, 1fr);
    }

    .btn-year,
    .btn-month,
    .btn-day {
        min-width: 30px;
        height: 32px;
        font-size: 0.65rem;
        padding: 4px;
    }
}

/********************************************
 * APEXCHARTS OVERRIDES (Tema Claro)
 ********************************************/
.apexcharts-tooltip {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.apexcharts-tooltip-title {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.apexcharts-legend-text {
    color: var(--text-secondary) !important;
}

.apexcharts-xaxis-label,
.apexcharts-yaxis-label {
    fill: var(--text-secondary) !important;
}

.apexcharts-gridline {
    stroke: var(--border-color) !important;
}