/* ================================================
   TASKFLOW PRO - DASHBOARD CHART STYLES
   ================================================
   Este arquivo contém todos os estilos relacionados
   aos gráficos e visualizações do dashboard.
   ================================================ */

/* ===== CHART CONTAINER BASE STYLES ===== */

/* Container padrão do gráfico */
.chart-container {
    min-height: 300px;
    padding: 20px 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.13);
    margin: 20px 0;
}

/* Container compacto para áreas menores */
.chart-container-small {
    min-height: 180px;
    padding: 10px 0;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.1);
    margin: 15px 0;
}

/* ===== CHART BARS - Estrutura das barras ===== */

/* Container das barras do gráfico */
.chart-bars {
    display: flex;
    align-items: end;
    justify-content: space-around;
    height: 200px;
    border-bottom: 2px solid #e2e8f0;
    border-left: 2px solid #e2e8f0;
    margin: 20px 0;
    padding: 20px;
    position: relative;
}

/* Barras em versão compacta */
.chart-container-small .chart-bars {
    height: 120px;
    margin: 10px 0;
    padding: 10px;
    border-width: 1px;
}

/* ===== INDIVIDUAL CHART BARS - Barras individuais ===== */

/* Container de cada barra individual */
.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    position: relative;
}

.chart-container-small .chart-bar {
    min-width: 40px;
}

/* Items individuais dentro de cada barra */
.chart-bar-item {
    width: 40px;
    min-height: 5px;
    margin: 1px 0;
    border-radius: 3px;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.chart-container-small .chart-bar-item {
    width: 25px;
    margin: 0.5px 0;
    border-radius: 2px;
}

/* Efeito hover nos items da barra */
.chart-bar-item:hover {
    opacity: 0.8;
    transform: scaleX(1.1);
}

/* ===== STATUS COLORS FOR CHART - Cores por status ===== */

/* Não iniciada */
.chart-bar-item.not-started {
    background: var(--status-not-started);
}

/* Em progresso */
.chart-bar-item.in-progress {
    background: var(--status-in-progress);
}

/* Em revisão */
.chart-bar-item.in-review {
    background: var(--status-in-review);
}

/* Completada */
.chart-bar-item.completed {
    background: var(--status-completed);
}

/* Bloqueada */
.chart-bar-item.blocked {
    background: var(--status-blocked);
}

/* ===== CHART LABELS - Labels dos gráficos ===== */

/* Labels das barras (nomes dos projetos) */
.chart-bar-label {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-gray-dark);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.chart-container-small .chart-bar-label {
    margin-top: 5px;
    font-size: 0.7rem;
    max-width: 50px;
}

/* ===== CHART LEGEND - Legenda do gráfico ===== */

/* Container da legenda */
.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.chart-container-small .chart-legend {
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
}

/* Items individuais da legenda */
.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--color-gray-dark);
    font-weight: 500;
}

.chart-container-small .legend-item {
    font-size: 0.7rem;
}

/* Cores da legenda */
.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    display: inline-block;
}

.chart-container-small .legend-color {
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-radius: 2px;
}

/* ===== CHART TOOLTIPS - Tooltips dos valores ===== */

/* Tooltip com valor ao passar mouse */
.chart-bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    z-index: 10;
}

.chart-container-small .chart-bar-value {
    font-size: 0.7rem;
    padding: 2px 6px;
    top: -20px;
}

/* Mostra tooltip no hover */
.chart-bar-item:hover .chart-bar-value {
    opacity: 1;
}

/* ===== CHART ANIMATIONS - Animações dos gráficos ===== */

/* Animação de entrada das barras */
@keyframes chartBarGrow {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

.chart-bar-item {
    animation: chartBarGrow 0.6s ease forwards;
    transform-origin: bottom;
}

/* Delay progressivo para cada barra */
.chart-bar:nth-child(1) .chart-bar-item { animation-delay: 0.1s; }
.chart-bar:nth-child(2) .chart-bar-item { animation-delay: 0.2s; }
.chart-bar:nth-child(3) .chart-bar-item { animation-delay: 0.3s; }
.chart-bar:nth-child(4) .chart-bar-item { animation-delay: 0.4s; }
.chart-bar:nth-child(5) .chart-bar-item { animation-delay: 0.5s; }

/* ===== CHART STATES - Estados dos gráficos ===== */

/* Estado de carregamento */
.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--color-gray-light);
    font-size: 1.1rem;
}

.chart-container-small .chart-loading {
    min-height: 120px;
    font-size: 0.9rem;
}

/* Estado de erro */
.chart-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--color-error);
    text-align: center;
}

.chart-container-small .chart-error {
    min-height: 120px;
}

/* Estado vazio */
.chart-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--color-gray-light);
    text-align: center;
}

.chart-container-small .chart-empty {
    min-height: 120px;
}

/* ===== CHART RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    /* Ajustes para mobile */
    .chart-bars {
        padding: 10px;
        height: 180px;
        margin: 15px 0;
    }

    .chart-container-small .chart-bars {
        height: 100px;
        padding: 5px;
        margin: 10px 0;
    }

    /* Barras menores em mobile */
    .chart-bar {
        min-width: 45px;
    }

    .chart-container-small .chart-bar {
        min-width: 30px;
    }

    .chart-bar-item {
        width: 30px;
    }

    .chart-container-small .chart-bar-item {
        width: 20px;
    }

    /* Legenda mais compacta */
    .chart-legend {
        gap: 10px;
    }

    .chart-container-small .chart-legend {
        gap: 5px;
    }

    .legend-item {
        font-size: 0.8rem;
    }

    .chart-container-small .legend-item {
        font-size: 0.65rem;
    }

    /* Labels menores */
    .chart-bar-label {
        font-size: 0.75rem;
        max-width: 60px;
    }

    .chart-container-small .chart-bar-label {
        font-size: 0.6rem;
        max-width: 40px;
    }
}

/* ===== CHART ACCESSIBILITY ===== */

/* Melhor contraste para modo escuro */
@media (prefers-color-scheme: dark) {
    .chart-container,
    .chart-container-small {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .chart-bars {
        border-color: #4a5568;
    }
    
    .chart-legend {
        border-color: #4a5568;
    }
    
    .chart-bar-label,
    .legend-item {
        color: #e2e8f0;
    }
}

/* Movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    .chart-bar-item {
        animation: none;
        transition: none;
    }
    
    .chart-bar-item:hover {
        transform: none;
    }
}

/* ===== CHART EXPORT STYLES ===== */

/* Estilos para exportação/impressão */
@media print {
    .chart-container,
    .chart-container-small {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .chart-bar-item {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== CHART INTERACTION IMPROVEMENTS ===== */

/* Melhor feedback visual */
.chart-bar-item:active {
    transform: scale(0.95);
}

.chart-interactive .chart-bar-item {
    cursor: pointer;
}

.chart-interactive .chart-bar-item:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Estados de seleção */
.chart-bar-item.selected {
    opacity: 1;
    transform: scale(1.1);
    z-index: 5;
}

.chart-bar-item:not(.selected) {
    opacity: 0.6;
}

.chart-bar.highlighted .chart-bar-item {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
