/**
 * Performance Chart Styles
 * Shared styles for performance charts with bars, trend lines, and labels
 */

/* Performance Chart Container */
.performance-chart {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

/* Chart Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-title {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-title h3 {
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.chart-metric {
    color: #10b981;
    font-size: 1.25rem;
    font-weight: 800;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    align-self: flex-start;
    width: fit-content;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.profit {
    background: linear-gradient(90deg, #ef4444, #10b981);
}

.legend-color.trend {
    background: #10b981;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(71, 85, 105, 0.3);
}

/* Chart Bars */
.chart-bars {
    display: flex;
    align-items: end;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.bar-item {
    width: 16px;
    background: linear-gradient(to top, #ef4444, #10b981);
    border-radius: 2px 2px 0 0;
    position: relative;
    height: var(--height);
    animation: growUp 1.5s ease-out;
    animation-fill-mode: both;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bar-item[data-value*="-"] {
    background: linear-gradient(to top, #ef4444, #f87171);
}

.bar-item:hover {
    transform: scaleY(1.1);
    filter: brightness(1.2);
}

.bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid #334155;
}

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

/* Trend Line */
.trend-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* Chart Labels */
.chart-labels {
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0 1rem;
}

/* Results Stats */
.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.results-stats .stat-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.results-stats .stat-card:nth-child(1) { animation-delay: 0.1s; }
.results-stats .stat-card:nth-child(2) { animation-delay: 0.2s; }
.results-stats .stat-card:nth-child(3) { animation-delay: 0.3s; }
.results-stats .stat-card:nth-child(4) { animation-delay: 0.4s; }

.results-stats .stat-card:hover {
    transform: translateY(-4px);
    border-color: #10b981;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #10b981;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 500;
}

/* Animations */
@keyframes growUp {
    from {
        height: 0;
    }
    to {
        height: var(--height);
    }
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .results-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .performance-chart {
        padding: 1.5rem;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        text-align: center;
    }

    .chart-title {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .chart-metric {
        align-self: center;
        font-size: 1.1rem;
    }

    .chart-legend {
        justify-content: center !important;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .legend-item {
        font-size: 0.85rem;
        justify-self: center;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .results-stats .stat-card {
        padding: 1.5rem 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}
