/* Pure CSS Charts - Gráficos com CSS Puro */

/* Container dos gráficos otimizado */
.css-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    padding: 1.25rem;
    position: relative;
}

.css-bar-chart-container {
    min-height: 200px;
    padding: 0.8rem;
    position: relative;
    overflow: hidden;
}

/* Loading state */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
}

.chart-loading .fa-spinner {
    margin-right: 8px;
}

/* Gráfico de Pizza - Otimizado para zoom 100% */
.pie-chart {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: conic-gradient(
        #28a745 0deg 0deg,
        #ffc107 0deg 0deg,
        #dc3545 0deg 0deg,
        #17a2b8 0deg 360deg
    );
    position: relative;
    margin: 0 auto;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.pie-chart:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.pie-chart::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0,0,0,0.1) inset;
}

.pie-chart-legend {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.legend-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid rgba(255,255,255,0.8);
}

.legend-color.todo { background-color: #17a2b8; }
.legend-color.progress { background-color: #ffc107; }
.legend-color.done { background-color: #28a745; }
.legend-color.overdue { background-color: #dc3545; }

/* Gráfico de Barras - Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 140px;
    padding: 15px 10px;
    background: linear-gradient(to top, #e9ecef 0%, transparent 100%);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.bar-chart::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #6c757d;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 45px;
    max-width: 60px;
    transition: all 0.3s ease;
    cursor: pointer;
    flex: 1;
    margin: 0 2px;
}

.bar-item:hover {
    transform: translateY(-5px);
}

.bar {
    width: 100%;
    min-height: 10px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, #007bff, #17a2b8);
    position: relative;
    transition: all 0.4s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bar::before {
    content: attr(data-value);
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #343a40;
    color: white;
    padding: 4px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.bar-item:hover .bar::before {
    opacity: 1;
}

.bar-label {
    margin-top: 8px;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    color: #495057;
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Animações */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes growHeight {
    from {
        height: 0;
    }
    to {
        height: var(--final-height);
    }
}

.pie-chart.animate {
    animation: fadeInScale 0.6s ease-out;
}

.bar.animate {
    animation: growHeight 0.8s ease-out;
}

/* Estados vazios */
.empty-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 16px;
    min-height: 200px;
}

.empty-chart i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

/* Responsividade otimizada para diferentes zooms */
@media (max-width: 1200px) {
    .pie-chart {
        width: 200px;
        height: 200px;
    }
    
    .css-chart-container {
        min-height: 240px;
        padding: 1rem;
    }
    
    .css-bar-chart-container {
        min-height: 280px;
        padding: 1rem;
    }
    
    .bar-chart {
        height: 200px;
        padding: 15px 0;
    }
    
    .legend-item {
        font-size: 13px;
        padding: 6px 10px;
    }
}

@media (max-width: 992px) {
    .pie-chart {
        width: 180px;
        height: 180px;
    }
    
    .css-chart-container {
        min-height: 220px;
    }
    
    .pie-chart-legend {
        gap: 8px;
    }
    
    .bar-chart {
        height: 180px;
    }
    
    .bar-item {
        min-width: 40px;
        max-width: 55px;
    }
    
    .bar-label {
        font-size: 11px;
        max-width: 45px;
    }
}

@media (max-width: 768px) {
    .pie-chart {
        width: 160px;
        height: 160px;
    }
    
    .pie-chart-legend {
        gap: 6px;
        flex-direction: column;
        align-items: center;
    }
    
    .legend-item {
        font-size: 12px;
        padding: 5px 8px;
        margin: 2px 0;
    }
    
    .bar-chart {
        height: 150px;
        padding: 10px 0;
    }
    
    .bar-item {
        min-width: 35px;
        max-width: 50px;
    }
    
    .bar-label {
        font-size: 10px;
        max-width: 40px;
    }
}

/* Temas de cores adicionais */
.bar.theme-primary { background: linear-gradient(to top, #007bff, #0056b3); }
.bar.theme-success { background: linear-gradient(to top, #28a745, #1e7e34); }
.bar.theme-warning { background: linear-gradient(to top, #ffc107, #e0a800); }
.bar.theme-info { background: linear-gradient(to top, #17a2b8, #117a8b); }
.bar.theme-danger { background: linear-gradient(to top, #dc3545, #c82333); }

/* Efeitos de hover avançados */
.pie-chart:hover::before {
    box-shadow: 0 0 20px rgba(0,123,255,0.3) inset;
}

.bar-item:hover .bar {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Indicadores de valor */
.pie-center-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
}

.pie-center-number {
    font-size: 24px;
    font-weight: bold;
    color: #343a40;
    display: block;
}

.pie-center-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
