/* Performance Tab Styles - Compact & Modern */
#portfolioTab .performance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#portfolioTab .performance-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

#portfolioTab .period-selector {
    display: flex;
    gap: 3px;
    background: #f3f4f6;
    padding: 3px;
    border-radius: 8px;
}

#portfolioTab .period-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

#portfolioTab .period-btn:hover {
    background: #e5e7eb;
    color: #667eea;
}

#portfolioTab .period-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Performance Metrics Grid - More Compact */
#portfolioTab .performance-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

#portfolioTab .metric-card {
    background: white;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s;
}

#portfolioTab .metric-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

#portfolioTab .metric-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 6px;
    font-weight: 600;
}

#portfolioTab .metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

#portfolioTab .metric-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Performance Chart - More Compact */
#portfolioTab .performance-chart-container {
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
    height: 380px;
}

#portfolioTab .performance-chart-container h4 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2c3e50;
}

#portfolioTab #performance-chart {
    height: 320px !important;
    max-height: 320px;
}

/* Holdings Performance - More Compact */
#portfolioTab .holdings-performance-section {
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

#portfolioTab .holdings-performance-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2c3e50;
}

#portfolioTab .holdings-performance-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#portfolioTab .holding-performance-item {
    display: grid;
    grid-template-columns: 70px 1fr 90px 110px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s;
}

#portfolioTab .holding-performance-item:hover {
    background: #e9ecef;
}

#portfolioTab .holding-symbol {
    font-weight: 700;
    color: #2c3e50;
    font-size: 0.9rem;
}

#portfolioTab .holding-bar-container {
    position: relative;
    height: 20px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

#portfolioTab .holding-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

#portfolioTab .holding-bar.positive {
    background: linear-gradient(90deg, #10b981, #34d399);
}

#portfolioTab .holding-bar.negative {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

#portfolioTab .holding-return {
    font-weight: 700;
    text-align: right;
    font-size: 0.9rem;
}

#portfolioTab .holding-return.positive {
    color: #10b981;
}

#portfolioTab .holding-return.negative {
    color: #ef4444;
}

#portfolioTab .holding-contribution {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: right;
}

/* Risk Metrics - More Compact */
#portfolioTab .risk-metrics-section {
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

#portfolioTab .risk-metrics-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2c3e50;
}

#portfolioTab .risk-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

#portfolioTab .risk-metric {
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

#portfolioTab .risk-metric:hover {
    background: #e9ecef;
}

#portfolioTab .risk-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 6px;
    font-weight: 600;
}

#portfolioTab .risk-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
}

#portfolioTab .risk-description {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Best/Worst Days - More Compact */
#portfolioTab .best-worst-days {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

#portfolioTab .day-card {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s;
}

#portfolioTab .day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#portfolioTab .day-card.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #6ee7b7;
}

#portfolioTab .day-card.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
}

#portfolioTab .day-card h5 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#portfolioTab .day-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

#portfolioTab .day-card.success .day-value {
    color: #065f46;
}

#portfolioTab .day-card.danger .day-value {
    color: #991b1b;
}

#portfolioTab .day-date {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

/* Loading and Error States */
#portfolioTab .loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

#portfolioTab .error-message {
    padding: 20px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .performance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .period-selector {
        width: 100%;
        overflow-x: auto;
    }

    .performance-metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .holding-performance-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .best-worst-days {
        grid-template-columns: 1fr;
    }

    #performance-chart {
        height: 300px;
    }
}
